Page 1 of 1

Need help with a find and replace expression - tks -

Posted: Sun Feb 06, 2005 8:35 pm
by travch
I am just trying out Advanced find and replace and it looks great.

Unfortunately I am a total newbie with regular or normal expressions and am going nuts about trying to replace some spaces into +. Sometimes it can be that there is no space if there is only on keyword within the value.

Hope someone can help me :)

I have following line in various html files:

<!--#set var="keyword" value="keyword1 keyword2 keyword3" -->

the keyword1 etc is allways a different word. It can be only one keyword or up to 6 keywords i.e. keyword1 keyword2 keyword3 keyword4 etc.

What I need to do is to keep the words the same whatever they are but replce the spaces inside the value variable into a +

The result should be like

<!--#set var="keyword" value="keyword1+keyword2+keyword3" -->

so one result example could be:

<!--#set var="keyword" value="hello+world+me" -->

an other

<!--#set var="keyword" value="hello" -->


<!--#set var="keyword" value="hello+today+is+my+birthday" -->

Hope I was able to explain in enough detail.

Any help is very appreciated.



Posted: Sun Feb 06, 2005 9:57 pm
by Abacre

There can be a plenty different variants.
For example one of them:

Go to Batch replace, enable "Use regular expressions".
Put into search for:
"keyword"(\s*)value="(\S*) (.*)"

Replace with:

Then press Execute button 5 times (as far as you have up to 6

I verified it works fine.

Posted: Sun Feb 06, 2005 10:48 pm
by travch
That worked like a charm :)

Thanks very much Roman.