I have a string that needs to be split based on the occurrence of a \",\"(comma), but need to ignore any occurrence of it that comes within a pair of parentheses. For exampl
Try this
\w{3}(?=,)|(?<=,)\(\w{3},\w{3}\)(?=,)|(?<=,)\w{3}
Explanation: There are three parts separated by OR (|)
\w{3}(?=,)
- matches the 3 any alphanumeric character (including underscore) and does the positive look ahead for comma
(?<=,)\(\w{3},\w{3}\)(?=,)
- matches this pattern (ABC,E4R)
and also does a positive lookahead and look behind for the comma
(?<=,)\w{3}
- matches the 3 any alphanumeric character (including underscore) and does the positive look behind for comma