Why can't I catch this tag???
Posted: Tue Apr 07, 2009 8:52 pm
Hi there,
I have a problem with catching tags, hope you can help. The regex works in all situations except the one I'm presenting, I'm trying to catch tags in the form, without nesting.
My regex:
It worked fine catching all the single tags except on this situation:
Has you might figure I want to get
But it returns one single wrong tag, like this:
I can't figure out what's the problem. Any help would be appreciated, thanks.
I have a problem with catching tags, hope you can help. The regex works in all situations except the one I'm presenting, I'm trying to catch tags in the form
Code: Select all
<tag />My regex:
Code: Select all
preg_match_all('/(<(' . $ftag . '+)[^>](.*)(\/>))/', $string, $matches, PREG_SET_ORDER);Code: Select all
$string = '<img src="<field name="media_file" />" width="<field name="media_width" />" height="<field name="media_height" />" border="0" alt=" <field name="media_description" /> " />'Code: Select all
<field name="media_file" />
<field name="media_width" />
<field name="media_height" />
<field name="media_description" />Code: Select all
<snapfield name="media_file" />" width="<snapfield name="media_width" />" height="<snapfield name="media_height" />" border="0" alt=" <snapfield name="media_description" /> " />