Search & replace with wildcards and variable length strings in Notepad++

find and replacenotepadregextext editing

I am trying to edit a series of strings in Notepad++ using search & replace. What I'd like to do is to search for a particular piece of HTML code, then delete a portion of it. The challenging part is that one word in the code segment varies.

For example, I'd like to find every instance of this:

/arama.php?shoes=bile 

(where "shoes" could be any word of varying length – sandals, boots, slippers, flipflops, etc.)

and replace it with just

/shoes=bile 

(where "shoes" is whatever the original word in that position of the string is).

Is this possible? Any ideas how?

Best Answer

you can use regex for this as others have suggested:

try something like

/arama.php\?([a-zA-Z]+)=([a-zA-Z]+)

replacement line would look something like

/\1=\2
Related Question