1

I want to find and replace a bunch of links, except I don't know how to format the search expression. I want to find the links that look like this:

http://website.com/test.php?id=930&name=hello

The 930 and hello are the variables that are different.

edit: I tried "http://website.com/test.php?id=.*&name=.*"> but it selects a bunch of stuff after that too like img src on that line etc

I tried using [^"]* or (.*?) instead of .* but it says it can't find the text :(

stema
  • 90,351
  • 20
  • 107
  • 135
Bbb
  • 11
  • 3
  • take a look at http://stackoverflow.com/questions/3587956/how-i-match-an-html-attribute-using-notepad-regular-expression-search – bensiu Mar 17 '11 at 23:46
  • I tried following it in the link you gave me, but it's not working. – Bbb Mar 18 '11 at 00:08

1 Answers1

3

Notepad++ seems to have limited regex. It doesn't use the nongreedy variants (.*?) and some anchors for word boundaries like \b, \Z are also not working.

I think this will help you:

http://website.com/test.php?id=\d*&name=\w*

insted of searching for .* which will also match to whitespaces, use \d* this will find only numbers and \w*, this will find only letters.

If the name can contain other things than letters than use this

http://website.com/test.php?id=\d*&name=[\w\d]*

and add into the [] all you need to match. in my example it will match letters and numbers.

Hint for future questions: Think about your tags. If you would have used the tag "regex", you would have gotten 5 answers within minutes for your question.

stema
  • 90,351
  • 20
  • 107
  • 135