Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Running the code will output:my $data = "\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11"; my @find = ( # These Work "\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11", "\x04\x05.{4}\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11", "\x04\x05\x06\x07\x08.{1}\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11", "\x04\x05\x06\x07\x08\x09\x0a.{1}\x0c\x0d\x0e\x0f\x10\x11", #These don't work "\x04\x05.{5}\x0b\x0c\x0d\x0e\x0f\x10\x11", "\x04\x05\x06\x07\x08\x09.{1}\x0b\x0c\x0d\x0e\x0f\x10\x11" ); foreach (@find) { if ($data =~ /$_/) { print "found\n" } else { print "not found\n" } +; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using regexp with binary data
by fizbin (Chaplain) on Aug 28, 2005 at 15:34 UTC | |
by Anonymous Monk on Aug 28, 2005 at 16:06 UTC | |
|
Re: Using regexp with binary data
by davidrw (Prior) on Aug 28, 2005 at 15:13 UTC | |
|
Re: Using regexp with binary data
by Joost (Canon) on Aug 28, 2005 at 15:26 UTC | |
by fizbin (Chaplain) on Aug 28, 2005 at 15:54 UTC | |
|
Re: Using regexp with binary data
by htj (Initiate) on Aug 29, 2005 at 06:57 UTC |