$str = 'href="http://grego.com" href="httpxoobar" href="xxx" href="ZZZZZ"';
preg_match_all('/http:\/\/(?<!href=")([\s\S]+)"/', $str,$m);
print_r($m);
I’m trying this code.
I want to create 4 matches, I want to match all the href=” that doesn’t have “http://” after it, and then get what is inside the href=”(this)” (I’m using \s\S because it may contain new lines) and when it finds a quote ( ” ) it stops and keep fetching the next (that in this case is in the same line),
in this example it should bring all 4 results.
how do I do that? Thanks.
You’ve got things a bit mixed up.
http://part of the match although you’re writing that you don’t want to match it,/soption to allow the dot to match newlines,That said, you might get away with this:
i. e. in PHP: