简体   繁体   English

RegEx匹配具有1个或更多结果的报价

[英]RegEx match quotes with 1 or more results

I'm trying to write a RegEx that matches the following 我正在尝试编写与以下内容匹配的RegEx

"Field1":"Any Content"

But not this 但这不是

"Field1":""

I've tried 我试过了

"Field1":".*?"

But it finds matches for "" 但它找到“”的匹配项

Thanks for your help. 谢谢你的帮助。

Try changing your zero-or-more quantifier ( * ) to a one-or-more quantifier ( + ): 尝试将零个或多个量词( * )更改为一个或多个量词( + ):

"Field1":".+?"

You may also want to consider using a character class, like this: 您可能还需要考虑使用字符类,如下所示:

"Field1":"[^"]+"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM