in reply to Regex: Extracting the case insensitive string and printing on the output

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).

Replies are listed 'Best First'.
Re^2: Regex: Extracting the case insensitive string and printing on the output
by rockstar99 (Novice) on Nov 28, 2011 at 10:13 UTC
    Thanks Ratazong. Made that simple. :)