I try to delete all lines with a length of 4 or less characters from a file that has a line per word (it is a very simple dictionary).
Deleting every short line in this gigantic file would be several hours of work.
Is there a way to automatically delete all words/lines including the \n automatically?
Okay, I found it out myself:
I created a regular expression (regex) and used "Replace all" with an empty replacement.
This was the expression:
Fine ! You were able to find out this regex by yourself. It's the best way to progress on making powerful regular expressions :-)
Just 3 hints :
If you don't mind to add the underscore character (_) to the allowed characters, use the \w form which is identical to the class character [A-Za-z0-9_]
Instead of the couple \r\n, you would better use the \R form which represents \r\n in a Windows file, \n in an Unix file or \r in an old Mac file !
You don't need to enclose words with the assertion \b ( word boundary ). Just, add the assertion ^ ( anchor ), at beginning of the regex, which stands for the very beginning of each line.
So, the final regular expression, to suit your needs, can be shortened in :
Enjoy our loved and powerful editor :)
You will find good documentation, about the new Perl Common Regular Expressions (PCRE), used by N++, since the 6.0 version, at the TWO addresses below :
The FIRST link concerns the syntax of regular expressions in SEARCH
The SECOND link concerns the syntax of regular expressions in REPLACEMENT
Thank you for your advice!
The topic is no longer of relevance for me, since I only needed the regex once, but some additional knowledge can't be wrong.