Consider this regular expression: <(.*)>
Applies to this line:
<2356> <my pal ned> < !@ %@>
Obviously, it will match the entire line due to the greedy * . A better solution would be to use a non-greedy quantifier like *? . However, many languages โโand editors do not support them.
For simple cases like the ones above, I limited this restriction to a regular expression as follows: <([^>]*)>
But what can be done with regex? start (.*) end
Applies to this line:
start 2356 end start my pal ned end start !@ %@ end
Is there any regression?
source share