in reply to regex man they are tough
You should insert some code tags to make it easier to read. Other than that, your logic seems messed up here.
You might try capturing what you want to keep in a s/// substition, like below (untested):
I would highly recommend reading a tutorial, such asforeach my $i (@n) { # strip any white space $i =~ s/\s//gm; # is the /m multi-line needed? # this checks for beginning with 16 digits, plus a matching string. # this will not match unless both the digits, and the string (plus 3 +0 chars on each end) # are in your string. $i =~ s/^(\d{16}).*?(.{30}Some search tring.{30})/$1$2/gm; # again, +is the /m needed? }
perldoc perlrequick perldoc perlretut
Update: fixed typo in my regex
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regex man they are tough
by Transient (Hermit) on Apr 28, 2005 at 16:11 UTC |