Regular Expression Help
Posted: Thu Jul 03, 2003 6:51 pm
I am trying to remove tags from a string of HTML in the following format:
I have the following right now:But that removes everything between the two farthest tags. Thanks for your help!
Now, in that scenario I would want to remove everything between if{ranks} and endif{ranks}, including the tags themselves. If I have multiple tags, however, it gets tricker. Here's an example:if{ranks}This is the ranking system!endif{ranks}
If I wanted to remove everything between the if{games} and endif{games} tags, but not what's in between. What is a regular expression which will not jump to the end and take everything from the first if{games} and the second endif{games} out - leaving nothing in the middle?if{games}games1endif{games}Testing this!if{games}endif{games}
I have the following right now:
Code: Select all
$template = ereg_replace('if{' . $statement . '}+(.*)+endif{' . $statement . '}','',$template);