How to remove version number from a list of programs in Notepad++

1

I want to remove/delete version number from my programs list in notepad++. How can I do it?

Example:

program 1   5.6.3
program 2   3.2.2
program 3   14.2.9

I want it like this:

Program 1
Program 2
Program 3

Rachid

Posted 2020-02-15T21:51:09.097

Reputation: 31

Answers

1

I want to remove/delete version number from my programs

  • Menu "Search" > "Replace" (or Ctrl + H)

  • Set "Find what" to (program \d).*

  • Set "Replace with" to \1

  • Enable "Regular expression"

  • Disable ". matches newline"

  • Click "Replace All"

enter image description here

Before:

program 1   5.6.3
program 2   3.2.2
program 3   14.2.9

After:

program 1
program 2
program 3

Further reading

DavidPostill

Posted 2020-02-15T21:51:09.097

Reputation: 118 938

It works thank you very much. But can you explain how it works, please? – Rachid – 2020-02-15T22:20:58.833

@Rachid Please read the further reading links if you want to learn how regular expressions work. – DavidPostill – 2020-02-15T22:24:40.633

oh! sorry, I didn't see it. – Rachid – 2020-02-15T22:28:36.610

@Rachid In the Find portion, (program \d) matches e.g. program 1 etc. while .* matches everything else in the line. The special part to note is the parentheses, which turns that portion into it's own capturing group. The replacement \1 means to substitute only what is matched by (program \d) (the first capture group). – Anaksunaman – 2020-02-16T01:28:26.850

0

For a small number of versions the fastest way is the column selection mode:

Press and hold the Alt key.

Then select the version block by moving the mouse to the x (see next section), press and hold the left mouse button, move the mouse to the y and release the left mouse button and the Alt key. Now press the Del key and the versions are gone.

           x 
program 1   5.6.3
program 2   3.2.2
program 3   14.2.9
                  y

Robert

Posted 2020-02-15T21:51:09.097

Reputation: 4 857

How do you do when the program names have very different length? thisIsMyProgram 1.0.0 and go 2.3.4 – Toto – 2020-02-20T19:06:04.267

@Toto In the question the schema was quite clear that there are visible fixed-size columns. As I said this way is only applicable in simple situations as shown in the question. For variable size columns that are just separated by comma, spaces or whatsoever the the regex way as presented by DavidPostill is the preferred way. – Robert – 2020-02-20T19:22:40.170