Use ( ) to grab what you want. The result(s) will be in the special variables $1, $2, ...
if ($mytarget =~ m/($mystring)/i) { print "It matches $1\n"; }
see perlretut (section on extracting matches).
In reply to Re: Regex: Extracting the case insensitive string and printing on the output
by Ratazong
in thread Regex: Extracting the case insensitive string and printing on the output
by rockstar99
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |