Re: Reg. Exp. Help
| From: | Scott Mebberson | Date: | Tue, 13 Feb 2001 03:59:03 +0000 |
| Subject: | Re: Reg. Exp. Help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-39326@lists.php.net to get a copy of this message | ||
I really need help with this.
I have written a regular expression that searches for any occurance of
src="*" in a html page and rewrites it so that it is equal to
src="http://www.whereever.com/images/filename.jpg"
-
If there are five occurances of this match then it replaces them all. Is
there anyway to make it only run once. Then if I want to loop and do it
again. I want to do this so I can put the contents of the original * in
src="*" into and array and access them later for uploading the files.
I think that maybe preg_match() or preg_match_all() is the answer but I have
know idea on how to make the regular expression I am using perl comptaible.
Here it is:
$txt = ereg_replace("src=\"([^>]+)\.(gif|jpg)\"",
"src=\"http://www.ezigraphics.com/images/about_0001."
. //2. "\"", $txt);
Any ideas is a huge help - thankyou
Thanks
Scott Mebberson
scott@redbluedesign.com