You want to match
name, dash, name, dash, name
or
( name, dash ) x 2, name
so
my ($substr) = $s =~ /^((?:[^_]*_){2}[^_]*)/ or die("No match\n");
In reply to Re^3: Quick regex
by ikegami
in thread Quick regex
by Karger78
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |