Forum Moderators: coopster

Message Too Old, No Replies

simple regex replace

         

CodilX

4:37 pm on Mar 22, 2010 (gmt 0)

10+ Year Member



Hi there,

I can't get the hang of regex..

Here's what I want to replace in my table

<tr id="filler">
<td></td>
<td></td>
<td></td>
</tr>


and replace it with {INSERT}

here's what I tried with no avail..

$text = preg_replace(array('<tr id=\"filler\">(.*?)</tr>'i","{INSERT}",$text);
$text = preg_replace("/<tr id=\"filler\">(.*)<\/tr>/iU","{INSERT}",$text);


can someone help me out with this?.. thanks

IanKelley

5:09 pm on Mar 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Use multi-line matching like so:

$text = preg_replace("~<tr id=\"filler\">(.*?)</tr>~is","{INSERT}",$text);