Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
Thread: little problem
01-26-2007, 05:59 AM #1
- Join Date
- Apr 2005
- Lahore, Pakistan
- Thanked 0 Times in 0 Posts
I have two regular Expression
$pattern = '!<img src="([^"]+)"!'; $replace = '<img src=images_test/'.'$1';
Actually i have write a small program which read a HTML file. And locate the all <img> tags in it
To locate the <img> tags, The first regular expresson is used.
And to replace the path found in <img> tag, i used the second regular expression.
which is $replace = '<img src=images_test/'.'$1';
Here see the last part of the expression: '$1'
in it all file paths are saved, which can be found while reading the file.
like it contains
This thing creates a little problem for me.
In '$1'I just want filenames, like 'picture.jpg', 'abc.jpg', 'pic3.jpg' instead of the whole path as
i use the basename functions in second regular expression and also try my best to got the desired output, but i am failed.
Kindly guide that how can i modify the second regular expression, so that it only contains filenames.
Please help me in this regard.