On Tue, Nov 4, 2008 at 9:29 AM, Pete <[EMAIL PROTECTED]> wrote:
>
> I am trying to clean up some text - example
>
> $x=preg_replace($rep, "abc", "<div class='his'><div
> class='hers'><p>cheese</p>");
>
> I want to end up with
> abc<p>cheese</p>
>
> I had
> $rep="/<div(.*)'>/";
> but that matches the LAST >, the one in </p>.
>
> I need it to match with "the first > after you have found <div"
>
> Can anyone tell me what I am doing wrong, please?
> Pete

Hi Pete,

I tend to ask reg for any character that is not a >, like this...

$rep = "/<div[^>]*>/";

Phill

Reply via email to