in reply to doubt in string matching.
heidi,
ikegami++
You have not clearly given what you are going to achieve. The following works as per your logic.
or Simplyuse strict; use warnings; my ($first, $last) = $find =~ /([A-Z])[A-Z]*([A-Z])/; #extract first a +nd last character if ($string =~ /$first/ && $string =~ /$last/) #check both character p +resent in string { my $out; for ($first..$last) #increment inbetween characters { $out = $out.$_ ; } print "'$find' string found" if ($string =~ /$out/); # if found pr +int the string }
my $string = "ABCDEFGHIJKLMNOPCDEFQRST"; my $find="CDEF"; print "'$find' string found" if ($string =~ /$find/);
Prasad
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: doubt in string matching.
by Mandrake (Chaplain) on Oct 17, 2006 at 05:39 UTC | |
by prasadbabu (Prior) on Oct 17, 2006 at 05:50 UTC | |
by Mandrake (Chaplain) on Oct 17, 2006 at 06:47 UTC | |
by prasadbabu (Prior) on Oct 17, 2006 at 06:59 UTC |