Posted by: vbr | Date: 01/28/2018 16:26 | IP: IP Logged
I am currently not using PhReplace and am not sure about the supported regex features, but it seems, that there are several possibilities for fine-tuning the regex pattern you are using:
you may try:
*? means a non-greedy quantifier - it matches as little as possible, instead of the * meaning as much as possible.
if this is not supported in PhReplace (or the underlying VBScript), you may adjust the pattern in other ways, e.g.:
in this case, any characters except of > are allowed -
if you know, that the paths to match are inside of html tags, i.e. the match should not contain a closing > (this will, however, also fail if > is somehow part of the tag content, e.g. label, etc.; I believe, this shouldn't happen normally).
I work with hundreds of html files.
I download them to local folder. Now i want to use one folder for images.
So i want to change all image sources in the file
<img alt="Product Image" src="./A57M_files/guven.jpg" width="700">
What i want
<img alt="Product Image" src="./images/guven.jpg" width="700">
to find this is use that regular expression
It works ok but if there are 2 images then it founds both.
<img alt="Product Image" src="./A57M_files/deneme.jpg" width="700"><img alt="Product Image" src="./A57M_files/test2.jpg" width="700">
It founds this;
src="./A58M-E_files/guvenpc1.jpg" width="700"> <img alt="Product Image" src="./A58M-E_files/
But i don't need after first ", how i make it stop after first " character.
and found only this and stop src="./A57M_files/