You are here: PSPad forum > English discussion forum > Re: Multi-Line Search Testers Needed

Re: Multi-Line Search Testers Needed

Goto Page: PreviousFirst...7 8 9 10 11 12 13 14 15 16 17

#161 Re: Multi-Line Search Testers Needed

Posted by: vbr | Date: 01/28/2018 16:26 | IP: IP Logged

Hi,
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:
instead of:
src="./(.*)_files/
you may try:
src="./(.*?)_files/

*? 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.:
src="./([^>]*)_files/

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).

hth,
vbr

erkange:
Hello all,

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

Source
<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
src="./(.*)_files/

It works ok but if there are 2 images then it founds both.
like this
<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/

Options: Reply | Quote | Up ^


Goto Page: PreviousFirst...7 8 9 10 11 12 13 14 15 16 17





Editor PSPad - freeware editor, © 2001 - 2018 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR