Closed ilanbiala closed 9 years ago
The g
is a global-modifier, which does what you say.
The non-greedy-character is the question mark in [0-9]+?
which makes my example match as little as possible, one number in this instance.
:smiling_imp:
/a/
and /a/g
produce the same regex, which could be misinterpreted...
@klorenz is anything in the works for this?
Hi,
there are two issues:
there is no work on this right now. How could it look like? any suggestions?
Just put something like (global) or (greedy) somewhere at the end, or at least list the flags to start and see what people suggest.
greedy could be implemented the same way a repeat {n1,n2} is implemented, where it shows greedy
rather than n1 to n2 times
as text in the back track loop (not sure what to call it).
Not sure about flags, maybe a vertical list to the left or right of the diagram?
I mostly care about the greedy thing because that is interesting. Also could we make non-capturing groups have a dashed border (or something) I could open a separate issue.
Ideally the diagram should be different if there is a
/g
at the end instead of/
, because it means that the regex picks up all instances, and not just the first one.