I am having trouble with regex lazy matching. It’s hard to explain without an example:
My regex: A\d*?(88)?\d*?B
Example 1: A12388456B
What I want: matches string, group 1 matches the “88”
What happens: matches string, but group 1 is not matched.
Example 2: A123B
What I want: matches string, group 1 not matched.
What happens: works correctly
Basically I want group 1 to match the “88” if it appears, but I want to also match any pattern A\d+B.
This seems like it should be simple, but I am having trouble.
Try out this regex in Javascript:
In the first example, group 1 captures 88.