[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] regex'ing binary goo??



Andy was right... Apparently '.' doesn't match a bunch of binary goo.
Throw the /s switch on your regex though and it seems to do what I
expected. I've used /s a million times, but never in the context of
embedded random binary crap in my scalars...


$ cat j.pl
foreach (
   "A00010\x{1b}\x{be}\x{a}\x{81}D00318",
   "A00010\x{a}\x{1c}\x{10}hD00318"
) {
   print (/^A00010.{4}/  ? "yes " : "no ");
   print (/^A00010.{4}/s ? "yes " : "no ");
}
print "\n";

$ perl j.pl
no yes no yes


/s is my friend. :)

j