On Thursday, July 10, 2003, 9:25:31 PM, Taylor wrote:

TY> First,
TY> I need the code to replace the link in a string, like

TY> <BASE HREF="www.google.com"> with <BASE HREF="mystring">

TY> ereg_replace("'<BASE HREF=\"'(.*)'\">'", "'<BASE HREF=\"$my_string\">'",
TY> $old);

TY> That was the closest i got, but (.*) makes it take the first BASE HREF, and
the last ">>, which sucks.
TY> Can anyone help?

I'm not a regex guru by any means, but I think your problem here is
that your expression is "greedy". Try (.?) ... I think.

TY> Second,
TY> I hate asking for help on Regexps...I would like a tutorial online that
TY> steps me through one method of them at a time, and then lets me move
TY> on...kindof like math. You have to know the basics befor you can get
TY> advanced.  Any help there either?

I have found that the best people to ask for regex questions are PERL
programmers. They seem to have the insider knowledge on this stuff.

There are a few online tutorials that I've seen, but none that I could
recommend with any confidence. They are simply "this expression does
this, and put it together ... wow it works! Regexs are great!"

There is a #perl channel on freenode (IRC) that I have found to be
extremely helpful in this regard.

If you do find any good tutorials, I would appreciate an offline.


-- 
Regards,
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to