in reply to Strange regexp problem

You seem to have a quoting problem, because the regex doesn't throw a syntax error without the string eval (why do you need that anyway?)

I'd suggest to write the main part of the regex outside the string eval, then you don't have to care about quoting.

my $main_re = qr/[^&#?(\w{2,7});|\\xeb|\\x(\w{2})|\\\\x(\w{2})|\\(\w{2 +,7})|\\'|\\\'|\'|\\"|\\"|\\"|\\\\|\w{5}|a-z|<(.*)>|<\/?.*>]/

Then you can interpolate $main_re into the regex.

BTW your regex is absolutely horrible to read, you should use the /e modifier and insert whitespaces, line breaks and comment.

Update: You seem to have alternatives (|) inside a (negated) char class - that makes no sense at all. Or did the markup go astray?

Replies are listed 'Best First'.
Re^2: Strange regexp problem
by akho (Hermit) on Aug 28, 2007 at 09:19 UTC
    You probably meant the /x modifier.
      Yes, you're right. I think "extended syntax" and that starts with an e... ;-)