Notepad++, search and replace?


#1

I’m trying to use the find in files tool to replace (the code on the right) with the code on the left

Heres my try

<div class="heading">\n\s\s<h4 class="float-right text-muted">Build 3.1</h4>\n\s\s<h1 class="text-center" style="margin:0 100px">\n\s\s\s<a href="index.html">\n\s\s<img src="../images/header_logo.jpg" class="img-fluid" id="main_header_logo">\n\s\sIntegrated Configuration Environment</h1>\n\s\s</a>\n\s\s</h1>\n</div>

with

<div class="heading">\n\t<div class="row">\n\t\t<div class="col-md-8 offset-md-2">\n\t\t  <a href="index.html">n\t\t  <h1 class="text-center">\n\t\t  <img src="images/header_logo.jpg" class="img-fluid" alt="Integrated Configuration Environment">\n\t\t\s\sIntegrated Configuration Environment\n\t\t\s\s</h1>\n\t\t\s\s</a>\n\t\t</div>\n\t\t<div class="col-md-2">\n\t\t\s\s<h5 class="text-muted">ICE Build .3 Data Version</h5>\n\t\t</div>\n\t</div>\n</div>


But Im gettting 0 hits, i know that code is in 142 pages also
what am I missing?


#2

tell Notepad++ to show you all characters. (View->Show Symbol->Show All Symbols).

Are your line endings \n? or \r\n? Do you have enough space characters (or should you be using a full regex to match them, perhaps)…


#3

Do I have an old version, cause I don’t see that option


#4

Well obviously you do, because you’ve selected it in your screenshot.
All of your lines end in CR LF, which means they have both \r (carriage return, CR), and \n (New line, or Line Feed, LF) control codes on them. So searching for just \n isnt going to work. Try using \r\n to match your newline instead.


#5

EDIT: Actually, the <div> line ends in just a LF. So that one WILL match \n.

But that’s technically a mistake. All the line-terminators in a file should be the same, for sanity in parsing. You may be editing the file in the wrong line-termination mode.