
fashimpaur
User
Jun 24, 2002, 1:19 PM
Post #3 of 3
(1251 views)
|
kidd, I see what Jean was trying to do, although I found it did not work in certain situations. So, in an effort to give you a more reliable regex, I came up with the following: my $string = "sp testing this regex sp\n sp isn't spelling fun sp"; #also try #my $string = "sp an asp is a very dangerous snake sp\n sp don't let it bite sp"; # and the original, #my $string = "sp A big string between sp\n sp Just fun sp"; $string =~ s/(^|\b)sp\b/~/gm; while ($string =~ /~([^~]+)~/gm){ print $1."\n"; } See if this doesn't handle words in the strings that start or end with 'sp'. Good Luck, Dennis $a="c323745335d3221214b364d545". "a362532582521254c3640504c3729". "2f493759214b3635554c3040606a0", print unpack"u*",pack "h*",$a,"\n\n";
|