Finding line beginning using regular expression

后端 未结 5 740
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-31 04:45

Finding Line Beginning using Regular expression in Notepad++

I want to strip a 4000-line HTML file from all the jQuery "done" attributes in a div.

5条回答
  •  长发绾君心
    2020-12-31 05:23

    You almost had it! Unfortunately, the complete solution in Notepad++ would have to be a 3 step process.

    1. Regex search/replace with the following search: \ 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".)

    2. 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...

    3. 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!

提交回复
热议问题