Compilation failed: lookbehind assertion is not fixed length

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
kusal
Forum Newbie
Posts: 14
Joined: Mon Oct 22, 2007 12:12 pm

Compilation failed: lookbehind assertion is not fixed length

Post by kusal »

Warning: preg_match_all() [function.preg-match-all]: Compilation failed: lookbehind assertion is not fixed length at offset 29


This is my code
'/(?<=Phone: \s? \<\/span\> \s*) [( \d].* \b/';

How can I over come this???
User avatar
GeertDD
Forum Contributor
Posts: 274
Joined: Sun Oct 22, 2006 1:47 am
Location: Belgium

Post by GeertDD »

PCRE doesn't support lookbehind constructions that can vary in length.

So either leave the \s? and \s* out, which is not an option I guess. Or just match the text in the lookbehind and then use capturing parentheses to pull out the part you really want.
kusal
Forum Newbie
Posts: 14
Joined: Mon Oct 22, 2007 12:12 pm

Post by kusal »

That is so bad, power of regex is simply went to waste :(
does .net support this??
Post Reply