Regex 创建正则表达式
我有一个字符串:Regex 创建正则表达式,regex,Regex,我有一个字符串: "shop": null, "amenity": null, "source": null, "public_transport": "stop_position", "religion": null, "history": null, "office": null, "place": null, "natural": null, "phone": null, "repair": null, "barrier": null, "craft": null, "noexit": n
"shop": null, "amenity": null, "source": null, "public_transport": "stop_position", "religion": null, "history": null, "office": null, "place": null, "natural": null, "phone": null, "repair": null, "barrier": null, "craft": null, "noexit": null, "atm": null, "shape:plan": null,
我想选择值为null的部分,比如“shop”:null,
“ament”:null,
我尝试使用表达式
,\s.*:\s“
,,\s.*null$
和其他变体,但没有得到所需的结果。我会使用JSON解析器,但为了回答您的问题,此正则表达式匹配值为null的属性:
(?<=")[^"]+(?=": null)
(?是字符串还是JSON?因此请使用JSON解析器而不是正则表达式。