Norman Graham wrote:
My thought is - does it work? What happens when you run it?
Works, yes.
Works as I want it to, no. 😉
What I want is a patterns that extracts everything between a <b> and </b>, but ONLY if there are no other tags nested.
// The pattern should find something in this haystack
// since there are <b> and </b> and something in between
$haystack = "<b>some text</b>";
// The pattern should NOT find anything in this haystack
// even though there are <b> and </b>, because there are tags nested
// (in this case the <i> and </i>)
$haystack = "<b>some text <i>in italic </i></b>";
// Is there some way of adding something to the (.*?), like (.*? !(< || >))
$pattern = "/<b>(.*?)<\/b>/si";
preg_match($pattern, $haystack, $out);
EDIT: Dave, just saw your post, I will try that... Thanks!
Any thoughts?
// Michelle