|
Posted by Stephen Kay on 03/22/06 04:00
in article 1142986667.329786.202020@i39g2000cwa.googlegroups.com, bobzimuta
at ejmalone@gmail.com wrote on 3/21/06 7:17 PM:
> Easiest way is to use a perl regular expression search and replace.
>
> Something like this?
>
> http://em.hopto.org/code/test/test_preg.php
>
> I'm feeling nice (and bored) today :-)
>
Thanks, that was helpful for the thing that I am working on, too.
However, maybe you can answer this - if I have a string formatted into a
variable, say $strip_it, which is:
$strip_it = "http://www.someaddress.com/somepage";
....and I wanted to strip this out of a whole page of code where it appeared
multiple times, how would you set the values?
From your example (note I am using PHP 4.4, so no count parameter):
$search = $strip_it;
$replace = ""; // replace with nothing
$result = preg_replace( $search, $replace, $initial_html, -1, );
I can't figure out how to set up $search - I keep getting different
errors...
--
Stephen Kay
Karma-Lab sk@karma-lab.NOSPAM.com
^^^^^^^
Navigation:
[Reply to this message]
|