http://stackoverflow.com/questions/406230/regular-expression-to-match-string-not-containing-a-word
I know it is possible to match for the word and using tools options reverse the match. (eg. by
grep -v
) However I want to know if it is possible using regular expressions to match lines which does not contain a specific word, say hede?
Input:
Hoho
Hihi
Haha
hede
# grep "Regex for do not contain hede" Input
Output:
Hoho
Hihi
Haha
Note that the solution to does not start with “hede”:
^(?!hede).*$
is generally much more efficient than the solution to does not contain “hede”:
^((?!hede).)*$
The former checks for “hede” only at the input string’s first position, rather than at every position.
How to remove new line in Notepad++?
You need something like a regular expression.
You have to be in Extended
mode
If you want all the lines to end up on a single line use \r\n
. If you want to simply remove emptylines, use \n\r
as @Link originally suggested.
Replace either expression with nothing.
沒有留言:
張貼留言