找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 68|回复: 1

[求助] 为何zm.RegExMatch正则匹配不到这串json,返回是null

[复制链接]
  • 打卡等级:无名新人

4

主题

6

回帖

14

积分

学前班

鲜花
0
猫粮
20
发表于 2025-3-11 10:51:14 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×

为何zm.RegExMatch正则匹配不到这串json,返回是null

正则表达式和json文本,都是确认过没有问题的
[按键精灵] 纯文本查看 复制代码
Function IsJsonValid(str)
	TracePrint str
    dim Pattern = "^{.*}$"'以 { 开头、以 } 结尾,中间包含任意字符(包括空字符)的字符串
    dim data = zm.RegExMatch(str,Pattern)
    zm.TracePrint data
    If data Then 
        IsJsonValid = true
    Else 
        IsJsonValid=false	
    End If
End Function



[按键精灵] 纯文本查看 复制代码
{"data": [{"text": "剩余时", "confidence": 0.9668843746185303, "text_box_position": [[142, 7], [204, 7], [204, 34], [142, 34]]}, {"text": "军备兑换", "confidence": 0.998140811920166, "text_box_position": [[33, 102], [124, 102], [124, 129], [33, 129]]}, {"text": "剩余时", "confidence": 0.9991335272789001, "text_box_position": [[142, 170], [204, 170], [204, 198], [142, 198]]}, {"text": "钢铁雄师", "confidence": 0.9973043203353882, "text_box_position": [[33, 266], [125, 266], [125, 292], [33, 292]]}, {"text": "剩余时", "confidence": 0.9991748929023743, "text_box_position": [[143, 331], [204, 334], [204, 362], [142, 359]]}, {"text": "能量灌注", "confidence": 0.9973416924476624, "text_box_position": [[33, 429], [125, 429], [125, 455], [33, 455]]}, {"text": "剩余时", "confidence": 0.9991474747657776, "text_box_position": [[142, 496], [204, 496], [204, 524], [142, 524]]}, {"text": "坦克转换", "confidence": 0.9990850687026978, "text_box_position": [[32, 592], [124, 592], [124, 620], [32, 620]]}, {"text": "剩余时", "confidence": 0.9992288947105408, "text_box_position": [[142, 659], [204, 659], [204, 688], [142, 688]]}, {"text": "自选豪礼", "confidence": 0.9714083671569824, "text_box_position": [[34, 755], [123, 755], [123, 783], [34, 783]]}, {"text": "剩余时", "confidence": 0.9994867444038391, "text_box_position": [[143, 822], [204, 822], [204, 851], [143, 851]]}, {"text": "疯狂歼灭", "confidence": 0.98348468542099, "text_box_position": [[32, 919], [125, 919], [125, 945], [32, 945]]}, {"text": "剩余时", "confidence": 0.9993963241577148, "text_box_position": [[143, 984], [204, 984], [204, 1013], [143, 1013]]}]}

楼主热帖
  • 打卡等级:武林至尊

1090

主题

2149

回帖

4349

积分

院长

鲜花
12
猫粮
7949
QQ
发表于 2025-3-12 09:44:31 | 显示全部楼层
不要加锚点^和$, 这个版本对这个锚点支持不好
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|紫猫编程学园

GMT+8, 2025-3-26 08:41

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表