Question: assume a text file with about 40k lines of

```
Color LaserJet 8500, Color Laserjet 8550, Color Laserjet 8500N, Color Laserjet 8500DN, Color Laserjet 8500GN, Color Laserjet 8550N, Color Laserjet 8550DN, Color Laserjet 8550GN, Color Laserjet 8550 MFP, 

```

as an example

any1 able to help me with a reg-ex that can trim out all data after the numbers, but before the comma? so that 8500N becomes just 8500

end result would be

```
Color Laserjet 8500, Color Laserjet 8550, Color Laserjet 8500, Color Laserjet 8500, Color Laserjet 8500, Color Laserjet 8550, Color Laserjet 8550, Color Laserjet 8550, Color Laserjet 8550, 

```

amazing bonus kudos to anybody that can then somehow suggest the best way to remove duplicates in notepad++ (or other easily available program)

Answer: 
You should replace each match of `(?<=\d)[^\d,]+(?=,)` with empty string.

The above regex reads: *"Any one or more non-digit and non-comma character(s) between digit and comma"*.

In case you may experience such number with trailing letter(s) at then end of string (or line) and you want that trim as well, even there is no comma behind, then use `(?<=\d)[^\d,]+(?:(?=,)|$)`

That reads similar, it just adds *"or end of string"* behind the first meaning.

---

***Update:***

Because it seems that Notepad++ does not support regex lookaround, then the solution is to replace `(\d)([^\d,]+)(,)` with `\1\3` or `(\d)[^\d,]+(,)` with `\1\2`.
How about this:

```
(.*?\d+)\D*(,)

```

It will match the entire thing, but you can just grab group 1 and 2. That will leave out the non-digits between the digits and commas.

The replace would be:

```
\1\2

```

[Here is a SO that elaborates that this is the only way to do this.](https://stackoverflow.com/questions/277547/regular-expression-to-skip-character-in-capture-group)

Or, as Arithmomaniac suggests, you could do this with one group, adding the comma back in after each match

```
(.*?\d+)\D*,

```

The replace would be

```
\1,

```