regexr
regexr copied to clipboard
Global search 'g' flag doesn't work in Tests
Adding the global flag for expressions works in 'Text' section but not in 'Tests' section.


I'm having the same or a similar issue.
@aniket-tyagi-ru I see your Test is a little different from mine though; you have selected "Match Full", which causes the failure in your specific test, I think. (That result may still be a bug, though).
My issue occurs with "Match Any". Technically, the Test passes, but I'd expect it to highlight all instances of the match as it does in Text. Perhaps the exiting behavior is intended since it "Match[es] Any" (the first instance) and then reports the test passing. Maybe the solution for my specific issue would be to have a "Match All" option to highlight/indicate all the match occurrences.
Tests (Does Not Work):

Text (Works):

I am facing the same issue. I have created an issue:
https://github.com/gskinner/regexr/issues/513
I hope this get fixed, since I see this problem seems to be existing at least since September 2020.
This is expected behaviour. The test is to "match any", so as soon as a match is found, the test is successful. It's optimized to not waste additional resources to find further matches because the pass/fail is already determined.