I am constructing a regular expression that will contain a number of groups in a logical OR relationship ...
(group A)|(group B)|(group C)
This expression already successfully matches its intended sub-strings, but I need to add a final group that will match anything else, with the result that the target string will be entirely consumed by matches.
Can anyone please suggest what this missing group expression should be?
Edit: Linefeeds are not an issue, so I assume we can use the simpler of the proposed syntaxes. However, I am clearly doing something really dumb, as I have simplified my expression such that it only contains (.*?) and it refuses to capture anything - just a bunch of empty matches. (I am using Rad Regex Designer for testing, but I have also tried another Regex tool and the result is the same).
Edit: As suggested, here is an example input. This is a simple Excel formula, but it could be any Excel formula:
SUM(A5:D9)+AVERAGE(F5:I5)-LOOKUP(L5, N5:N14)
The group expressions described above are designed to extract cell references (e.g. L5) or cell range references (e.g. F5:I5). So, when the expression is executed against the sample input, it must produce the following 9 captures:
SUM(
A5:D9
)+AVERAGE(
F5:I5
)-LOOKUP(
L5
,
N5:N14
)