in reply to Re: Regular Expression Problem
in thread Regular Expression Problem

It looks like there is no update or comment option, so I guess I'll reply to you again. The following assignment:
$remainder =~s/<.*?a.*?href.*?>//i;
cuts nothing out, leaving the following in $remainder:
<a href="government.php" ONMOUSEOUT="imgInact('img2')" ONMOUSEOVER="imgAct('img2')"><img border="0" src="gova.jp +g" width="60" height="46" name="img2" alt="Arkansas Government"></a>

(unless I'm still missing something). I want only the </a> to remain. Am I doing something wrong?

Replies are listed 'Best First'.
Re: Re: Re: Regular Expression Problem
by the pusher robot (Monk) on Aug 29, 2002 at 04:04 UTC
    I tested it and it removed the <a> tag, leaving <img border="0" src="gova.jpg" width="60" height="46" name="img2" alt="Arkansas Government"></a>. Do you want the <img> tag removed as well?
      Sorry... I was on a public computer with my time running out and I didn't read my code carefully enough. I want to keep the img tag and everything after the one with href. I think I just have to replace that dot with something. I have to see if /s/S means any number of any character. I've heard conflicting stuff about it. Update... got my s stuff mixed up. Think I just need to add a /s modifier. Better yet, it sounds like I can use a module, but I've come this far, and of the code is right in front of me, I'll use it. Second update... Problem solved. The s modifier after the i modifier worked!
Re: Re: Re: Regular Expression Problem
by Wassercrats (Initiate) on Aug 29, 2002 at 03:59 UTC
    Oh! There's a line-break in there! I need the alternative to . that will match a line brake!