Regex replace in notepad++ but only certain parts of line -


i have file lines this:

<a href="/foldername/subfolder/anothersubfolder/name%20of%20document.pdf">name%20of%20document.pdf</a> 

i convert to:

<a href="/foldername/subfolder/anothersubfolder/name%20of%20document.pdf">name of document.pdf</a> 

ie, replace escaped space characters (%20) literal space character, in link name, not in url.

i need remove other escaped characters, not spaces.

how can in notepad++?

as have 1 href per line, do:

  • ctrl+h
  • find what: ^.+?>[^%\n\r]*\k%20
  • replace with: a space
  • replace all

click replace all many times needed

explanation:

^           : begining of line .+?         : 1 or more character, not greedy >           : literally > [^%\r\n]*   : 0 or more character not % or line break \k          : forget have seen until point %20         : literally %20 
  • do not check . matches newline

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -