PHP perl regular expression - URL not preceded by equal sign and possible single or double quote
Regular Expressions
1
Posts
1
Posters
3
Views
1
Watching
-
I'm trying to create a perl regular expression that matches a URL that is not preceded by an equal sign and one single or double quote (optional) ignoring whitespace. The code below gives an error:
Warning: preg_replace(): Compilation failed: lookbehind assertion is not fixed length at offset 0
I know my URL regular expression isn't perfect, but I'm more focused on how to do the negative lookbehind or how to express this in some other way. For example, in the code below, I would like for the expression to match http://www.url1.com/ and http://www.url3.com/, but not the other URLs. How can I do this? The code below gives a warning and does not populate the $matches variable. The Code:
$html = " http://www.url1.com/ = ' http://www.url2.com/ 'http://www.url3.com/ [Testing1](http://www.url4.com/) Testing2"; $url\_pregex = '((http(s)?://)\[-a-zA-Z()0-9@:%\_+.~#?&;//=\]+)'; $pregex = '(?
Perl Regex in PHP, using ` instead of /:
'`(?