Delete all lines until a specific line in Notepad++
I have to edit a lot of source codes similar to each other.
random blah
random blah
blah
<table style="width: 232px; font-size: small;" cellpadding="0" cellspacing="0">....
What I want to do is to delete lines until table tag. 开发者_JAVA技巧I think I can do it with Regex search but I couldnt write the regex pattern. Thank you
You have to go through multiple steps to do what you stated above:
Go to the replace window, select the "extended" mode, and in the "find what" field type in "
\r\n
" and replace them with: "LINEBREAK
" (theres a space after 'LINEBREAK'). Click on replace all.Go to the replace window again, select the "regular expression" mode, and in the "find what" field type in
"(.*)(.*)(<table)(.*)(>)(.*)(.*)"
and in the replace with field, type in "\2\3\4\5
". Click on replace all.Now go to replace window again, select elect the "extended" mode, and in the "find what" field type in "
LINEBREAK
" (theres a space after 'LINEBREAK') and replace them with: "\r\n
". Click on replace all.
Notepad++ doesn't support multi line regex, which makes it hard to do what you wanted to do without going through the steps given above.
you can try something like:
(^.*$\n)*<table(.+)>
First group will match all lines before your table tag %)
精彩评论