I want to strip a 4000-line HTML file from all the jQuery "done" attributes in a div.
I'm afraid, Notepad++ Regex cannot do that
Notepad++ using Scintilla regex engine, its per line based, so multiline search / replace cannot be done.
Note that \r and \n are never matched because in Scintilla, regular expression searches are made line per line (stripped of end-of-line chars).
Quoted from http://www.scintilla.org/SciTERegEx.html
Extended Replace "\n" with "LINEBREAK "
Thanks a lot to all for these timely replies. Following your advices, here's what I did:
Under "Regular expression", replaced each occurrence of:
done[0-9]*="[0-9]*"
(Be careful to check there is THE HEADING SPACE before "done"
and there is NO TRAILING SPACE! see below)
with an empty string
Recalls and Notes:
I like Notepad++ too but the regexing is really a pain. If you insist on using Notepad++ try this:
done[0-9][0-9]*=\"[0-9][0-9]*\"
with the empty string (be sure to put
a single space before the regex
expression)Voila! Not very nice n clean but it works ;o)
After that if you want it human-readable again you could use the HTMLTidy functions
You almost had it! Unfortunately, the complete solution in Notepad++ would have to be a 3 step process.
Regex search/replace with the following search: \<done[0-9]+="[0-9]+"[ ]*
Of course, leave the replace field empty, so that it will simply delete everything that matches. (In Notepad++ understanding of regular expressions \<
represents the "beginning of a word".)
Select the portion of text affected by your previous search/replace. You don't want to select the entirety of your document, because we're going to...
Strip newlines. Hit Ctrl-F to bring up the Search/Replace dialog again and this time select "Extended" search mode, instead of "Regular expression". Depending on the format of your document you are going to want to search for either \n
or \r\n
. The replacement field should, again, be empty. Also, make sure that the "In Selection" checkbox is checked.
Click "Replace All" and you're done!
A simple way is:
It will plug your string at the beginning of each line except the first line.