This does the transformation you asked for but I'm not sure it meets your readability requirement. Certainly not the way I'd parse tokens out of a string.
$string="glarch capri foobar"; $r=q/Capri|Classic/; $string=~m/($r)/i; $r=~m/($1)/i; print $1; ... Returns 'Capri'
In reply to Re: Getting characters from regex pattern
by starbolin
in thread Getting characters from regex pattern
by devnul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |