gpt4 book ai didi

python - 匹配除字母以外的任何内容 - 正则表达式

转载 作者:太空宇宙 更新时间:2023-11-03 13:20:29 25 4
gpt4 key购买 nike

如何匹配除字母以外的任何内容?我认为 [^a-z]+ 可以,但不是真的。

我要搜索这个字符串:

"price":"7.99","opt":{"1":[1.01,1.02]},"mixedId":0,"price":"8.99","opt":{"3":[1.03],"4":[1.04,1.05]}

我想获取这些值 8.991.04,1.05 但它不能匹配 7.99

我喜欢这样:

'"price":"(.+?)","opt":\{"[^a-z]*"4":\[(.+?)]'

但它什么也没找到。需要一些支持:)

最佳答案

您的固定 RegEx 应如下所示:

"价格":"([\d\.]+?)","选择":\{"[^a-z]*"4":\[(.+?)\]

现场演示:http://regex101.com/r/iU3oT7

关于python - 匹配除字母以外的任何内容 - 正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15348457/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com