0

With the help of some of the guys here I have some regex to match strings in quotes that aren't in brackets:

"one" - matches
("two") - doesn't match

Is it possible to repeat the match so the input:

"one" ("two") "three"

would return one and three? The only thing I can think of doing is capturing whatever is left over and reprocessing with the same regex, i.e:

process > "one" ("two") "three" - returns one and "("two") "three""
process > ("two") "three"       - returns failed and "three", not sure how but hey
process > "three"

I'm learning regex at the moment so just wondering if this functionality is built in?

NB: this may be a repeat of refering to already existing group in regex, c# but not clearly enough for me to follow :(.

Community
  • 1
  • 1
Patrick
  • 8,175
  • 7
  • 56
  • 72

1 Answers1

3

You need the Regex.Matches() function which returns all of the substrings that match the regex.

Alnitak
  • 334,560
  • 70
  • 407
  • 495