I am working with an editor that makes two different link structures depending on the browser used to insert the images.

$MyFile = 'http://localhost/m-ysite/images/image.jpg';
$MyFile = 'http://localhost/m-ysite/editor/plugins/../../../images/image.jpg';

I am really looking for a relative path to the image and want to remove everything before "images".
I am trying to get this expression(s) to work and it is showing a match.
I just cannot get it to return or replace the targeted words.


       if (eregi("http( |[a-z0-9:/.-])*images",$MyFile))
{
$MyFile2 = (eregi("http( |[a-z0-9:/.-])*images",$MyFile));

$pattern = (eregi("http( |[a-z0-9:/.-])*images",$MyFile));
$replacement = '';
$MyFile3 = eregi_replace($pattern, $replacement, $MyFile);

echo"<br>$MyFile"; // retuns the string
echo"<br>$MyFile2"; // retuns the number "1" ??
echo"<br>$MyFile3<br>"; // retuns the whole string again
}

I know to escape some chars but also cannot figure out how to add _ to the regex

If there is an _ in the url it does not match and no matter what I do I cannot work it in.

If someone can help get the trimmed string into a variable I can work with it.


TIA
Regards Loren

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


____ • The WDVL Discussion List from WDVL.COM • ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
      Send Your Posts To: [email protected]
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to