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 :(

2
  • take a look at stackoverflow.com/questions/3587956/… Commented Mar 17, 2011 at 23:46
  • I tried following it in the link you gave me, but it's not working. Commented Mar 18, 2011 at 0:08

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.