Lukie
Lukie

Reputation: 905

RegEx match quotes with 1 or more results

I'm trying to write a RegEx that matches the following

"Field1":"Any Content"

But not this

"Field1":""

I've tried

"Field1":".*?"

But it finds matches for ""

Thanks for your help.

Upvotes: 2

Views: 77

Answers (1)

p.s.w.g
p.s.w.g

Reputation: 149078

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":"[^"]+"

Upvotes: 5

Related Questions