No, I didn't forgot the question marks, and I used capturing parens on purpose. But I was answering a different question than was actually asked.
It could actually turn out more efficient with a slight variation:
m!((?>(?>(?>\w+/)?\w+/)?\w+/)?\w+/?)!;
I haven't done any benchmarks though.
Makeshifts last the longest.
In reply to Re^3: regex greedy range
by Aristotle
in thread regex greedy range
by johnnywang
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |