Regex Preg_match Issue
Posted: Mon Jun 09, 2008 12:59 pm
The odd part, is to test my regex patterns, I use dreamweaver's search function and check the option "use regex", and when I test it there, the pattern matches as expected.
Here is a brief example of what code I'm using:
Any ideas as to what could cause this?
Thank you!
Here is a brief example of what code I'm using:
The code above seems to only match the "<" and ignores the regex saying not to match if the next characters are "br", "a", "sub", or "/". So the above code cuts off at the first <sub>, although, when i test searching the same content in dreamweaver with regex enabled, it stops at the first <b> in front of applications-- just as i expect it to.<?php
$content = 'Anti-CD22 immunotoxins consist of a disulfide-linked FV (V<sub>H</sub>/V<sub>L</sub> ) antibody fragment recombinantly linked to a <a href="#">toxic<a> moiety capable of killing cells. <br><br> <b>Application:</b> These immunotoxins have been shown to have activity against various forms of cancer.';
$regex = '/<(?!br|a|sub|\/)/';
preg_match_all($regex, $content, $end_match);
$pos = strpos($content,$end_match[0][0]);
$result = substr($content,0,$pos);
?>
Any ideas as to what could cause this?
Thank you!