I'm not 100% clear on what your requirements are (that is, what the possible contents of the lines to be deleted are) but I've made a regex going off of the assumption that the line starts with between 1 and 3 numbers, followed by an optional full stop, and without anything else on the line (beginning or end).
Find what : ^\d{1,3}\.?\r?\n?
Replace with : (blank)
Tested on the following dataset
102.
102
12
12
1.
1
9999
ab21.
8442.
which leaves behind
9999
ab21.
8442.
Explanation
^
is a special character that matches the very start of the line only. This is just to make sure that the pattern isn't simply on the end of a longer line.
\d
is used to match any numerical value (that is, 0-9).
{1,3}
is used to modify the previous statement (in this case, \d
), and is used to specify the minimum and maximum number of times that you want that statement to match. Therefore, this line says that you want to match a number between 1 and 3 times (inclusive).
\.
is used to match the dot character. .
is a special character in regex, used to match any character (except a newline by default, although there is an option in Notepad++ to change this behaviour). Due to this, we need to escape it with a backslash to make sure that it is taken as .
"the character" and not .
"the matching pattern".
?
is used to modify the last statement similar to {1,3}
, but this time it is used to say that the previous statement ([.]
) is optional (technically it says to match it between 0 and 1 times, but the end result is the same).
\r?\n?
is used to match the new line as you mentioned already. The regex would work without this, but it wouldn't remove the line, only clear it (leaving a blank line behind). By making both \r
and \n
optional, this will become portable across Windows, Linux, and Mac.
Finally, the reason that we leave the Replace with :
field blank is simply because of the fact that we don't want anything to go back into the line that we're deleting.
Hopefully this is what you were looking for and, if not, points you in the right direction.
This sounds like a good candidate for the Notepad++ macro feature.
Record the following steps (Macro menu → Start Recording):
- Ctrl+Shift+→
- Edit menu → Convert Case To → UPPERCASE
Then stop recording (Macro menu → Stop Recording) and save the macro (Macro menu → Save Current Recorded Macro). You can then define some combination of Ctrl, Alt, Shift, and another key to run your macro whenever you want.
Best Answer
You may have to do it in batches (if your number column isn't zero padded to a constant width) but you can use column-selection (just tested working as of notepad++ 5.9.3) to select just the numbers, then use Edit->Column Editor (Alt-C) to set your start and end numbers.
This may not be much help either, if your numbers are neither zero-padded nor ordered, but hopefully it will be some help.