![]() |
Need regular expression help
I got the following to match an image tag with a path beginning with a / and replace it with a variable called domain that ends with a /
$a = eregi_replace(" src=\"/"," src=\"$domain/",$a); I want to know how I can write one or more new lines to match a similar image tag path that does not begin with a / and does not begin with a http for example <img src="images/someimage.gif"> |
Why don't you just do this in .htaccess, or set a <base href=.../>? What you're trying to fix shouldn't really be done that way. However, you can src=\"(/?) to just assume another localized request.
If you really want a semi-decent way to grab and rewrite your links: Code:
$preg = "/[\s]+[^>]*?src[\s]?=[\s\"\']+(.*?)[\"\']+.*?>/i"; Code:
foreach ($outvar as $imgsrc) { |
Thanks for the tips, trying now.
|
All times are GMT -7. The time now is 09:31 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123