Currently I'm doing:
Regex.Match(ln, "\"[\\u0000-\\u007E] \"")
The problem is if ln is like ""text..."" it won't work as wanted.
Same to """text...""", etc...
How can I make the " " repetitive?
It should also match to "text1"text2"text3".
The point is, it should match with the most 2 outer " " if the number of " is par or cut the last " if number impar.
Ex: "stack"overflow" -> match "stack"
Ex: "stack""overflow" -> match "stack""overflow"
Ex: text1""text2""text3 -> match ""text2""
Ex: "text1"text2"text3 -> match "text1"
Any idea how to make this pattern?
CodePudding user response:
An idea is to work with negated " between.
- Match
"[^"]*" - Repeat
[^"]*"[^"]*"any amount of times
"[^"]*"(?:[^"]*"[^"]*")*
See this demo at regex101 (the \n in multiline demo is for staying in line)
