Question

I really need a quick help.

Can someone tell me how to find and replace for example:

<a href="blab34345.html">Apple</a><br />
<a href="bl44abla123415646.html">Pear</a><br />
<a href="blabla12354134.html">lemon</a><br />

into:

<a href="blabla.html">Apple</a><br />
<a href="blabla.html">Pear</a><br />
<a href="blabla.html">lemon</a><br />

Thank you ! :)

Was it helpful?

Solution

In Notepad++ you can do it easily using regular expressions. Go to Search > Replace menu (shortcut CTRL+H) and do the following:

  1. Find what:

    a href="\K.+?(?=\.html")
    
  2. Replace:

    blabla
    
  3. Select radio button "Regular Expression"

  4. Then press Replace All

You can test it and see the results for your specific example at regex101.

OTHER TIPS

In Notepad++, ctrl+h brings up the replace menu. I do not know if there is a character limit, but that should be all you need.

Notepad++ sometimes get wrong results when using variables like $var but most of the times with tags doesn't happen, so simple as pressing ctrl + H gets you the replace tab and search for the string.

Or as @Mike Christensen said are you looking for a regular expression solution?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top