eshban
01-24-2007, 12:08 PM
Hello,
I have facing a problem. Kindly help
I have a Regular expression
$pattern = '!<img src="([^"]+)"!';
I have a php code which reads a html file, then that regular expression searches <img> tag
Becoz according to my requirement i have to change the default path found in <img> tag.
Here is another regular expression
$replace = '<img src=images/'."$1";
This is used to replace the current path found in an html document.
Suppose, i have an html file, in that html file there are two <img> tags and those have these paths like
<img src = "abc/first_pic.jpg">
<img src = "admin/img/picture.jpg>"
My Requirement is to change the path "abc/first_pic.jpg" to "images/first.jpg"
and
"admin/img/picture.jpg" to "images/picture.jpg"
Means in every requirement i use this path i.e. 'images/anypicturefile.jpg'
For that purpose i must change my current regular expression which is
$replace = '<img src=images/'."$1";
Can anybody help me to change this regular expression $replace = '<img src=images/'."$1"; ,so that it fullfills the above requirement
I have facing a problem. Kindly help
I have a Regular expression
$pattern = '!<img src="([^"]+)"!';
I have a php code which reads a html file, then that regular expression searches <img> tag
Becoz according to my requirement i have to change the default path found in <img> tag.
Here is another regular expression
$replace = '<img src=images/'."$1";
This is used to replace the current path found in an html document.
Suppose, i have an html file, in that html file there are two <img> tags and those have these paths like
<img src = "abc/first_pic.jpg">
<img src = "admin/img/picture.jpg>"
My Requirement is to change the path "abc/first_pic.jpg" to "images/first.jpg"
and
"admin/img/picture.jpg" to "images/picture.jpg"
Means in every requirement i use this path i.e. 'images/anypicturefile.jpg'
For that purpose i must change my current regular expression which is
$replace = '<img src=images/'."$1";
Can anybody help me to change this regular expression $replace = '<img src=images/'."$1"; ,so that it fullfills the above requirement