Reputation: 9681
Im trying to match a line of code which only has one double quote ("). I have tried:
\"{1}
on the following strings
"this is a string"
"this is a string
the regex should only match the second line but it matches both of them.
Anyone know how to do this?
Upvotes: 0
Views: 1028
Reputation: 324650
If you want to find out if there is only one double-quote character on any given line, try this:
/^[^"]*"[^"]*$/m
Note the m
modifier - this allows ^
and $
to match the start and end of any given line, as opposed to just the start and end of the matched string.
Upvotes: 2