R
Ram Prasad
I have a somewhat strange requirement
I want to find if a regex matched what exactly matched
to reproduce this
------------------
my @x;
$x[0] = 'chi+ld*';
$x[1] = '\sjoke';
$_=getinput(); # for test assume $_="This is a joke";
if(/($x[0]|$x[1])/){
print "Matched '$1' \n";
}
-----------------
I want to know if $x[0] matched or $x[1] matched
What is the most efficient way of doing this ?
Thanks
Ram
I want to find if a regex matched what exactly matched
to reproduce this
------------------
my @x;
$x[0] = 'chi+ld*';
$x[1] = '\sjoke';
$_=getinput(); # for test assume $_="This is a joke";
if(/($x[0]|$x[1])/){
print "Matched '$1' \n";
}
-----------------
I want to know if $x[0] matched or $x[1] matched
What is the most efficient way of doing this ?
Thanks
Ram