0

I am trying to create a Regex expression with a numerical reference (to a capture group) in a neglected set.

Something like this:

 (["'])([^\1]*)(\1)

Basically it matches all strings with either a single or double quote surrounding it. For example:

"foo bar" "foobar""foo bar" and "foo bar"


The reason I can't just use the (["'])([^"']*)(\1) is the following scenario:

"foo bar's" "foobar"

Instead of matching "foo bar's" and "foobar" it matches " ".


How can I use numerical reference in a neglected set? If I can't how can I overcome this issue?

JBis
  • 827
  • 1
  • 10
  • 26
  • I have answered your question over at the duplicate marked one because that is not a duplicate of this and when a question is marked a duplicate, it is essentially unreachable (burried) for good. –  Dec 10 '19 at 23:14
  • @x15 If you feel this is not a duplicate situation you can vote to re-open this question? But you then should state in a comment how, *technically*, the information in the duplicate does not solve this problem. (I don't know enough about RegEx to be able to judge.) – Cindy Meister Dec 11 '19 at 06:24
  • @x15 thanks, the other question is similar enough and the answers apply to both that this can be considered a dup – JBis Dec 11 '19 at 15:33

0 Answers0