[prog] Perl regex

Almut Behrens almut-behrens at gmx.net
Fri May 9 13:51:07 EST 2003


> Hi everyone.
> 
> I'm writing a Perl program that includes this line of code:
> 
> if ( $html =~ m!<div><script>.{0,10}\s*
>      function\s+Filtered.{0,10}[{]\s*return\s+0.{0,5}[}]\s*.{0,20}
>      </script>(.*?)<font color=\#000000></div>!si ) {
> 
> (I put it on several lines for legibility, but it's all one line in the 
> program, with no space characters in the regular expression.)
> 
> I want to use the "/x" modifier (it would be "!x" in this case) to split 
> the regular expression onto several lines for readability. However, when I
> 
> add the "x", the regular expression fails to match against a test case
> that it matched previously, even before I split it onto several lines.
> 
> I've already noticed the "#" near the end (<font color=#000000>) and 
> escaped it. (I've also tried putting it in [].) I have ruled that out as a
> source of the problem. Does anyone have any idea what the problem is?


have you also tried escaping the space?  (--> ...font\ color...)


Almut


-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!



More information about the Programming mailing list