Page 1 of 1

Help with regex find/replace in Dreamweaver

Posted: Tue Mar 20, 2012 9:31 am
by m2244
Hello,

I need help with a regex find and replace. I want to replace this string

'showPopUp(url, title, width, height)'

with this string

'showHidePup(url, title)'

The name of the function changes and the width height attributes are no longer needed. I have the regex that finds the first string

Code: Select all

showPopUp\(.+\)
But how can I replace it with a new function name and remove those last 2 attributes without changing the 'url' and 'title' attributes?

Re: Help with regex find/replace in Dreamweaver

Posted: Tue Mar 20, 2012 2:35 pm
by ragax
HI m2244,

Welcome to the forum.

Try this. I just tested in DW 5.5, it worked with my test strings.
Search:

Code: Select all

showPopUp\(([^,]+,[^,]+)[^)]+\)
Replace:

Code: Select all

showHidePup($1)
Note that with this particular phrasing, the regex will run into trouble if the title contains commas.
Let us know how this work and if you need more help. :)