Ben Yermak
Ben Yermak

Reputation: 95

Notepad ++ - keep numbers only

I have a text file containing numbers and characters (in arabic)

like this:

943894رنيش964737

ترشقة1045051

ضمنزلبالق10653

to this:

943894964737

1045051

10653

I want to remove everything apart from the numbers

I looked at a possible solution here:

Find/Remove (keep only Numbers)

But its not working for me, plus its not very clear to me

Upvotes: 8

Views: 19205

Answers (2)

kwadratens
kwadratens

Reputation: 345

Just an addition to @x4rf41 idea

If You are working with some Excel-like data, where You got columns, copying this data to Notepad++ makes breaks between columns with tab ("\t"). So if You want to keep this breaks, or just leave the column breaks when you put them back into Excel, you have to use:

[^\d\r\n\t]

so you will leave tabs and data will remain in the correct structure when You will copy it to Excel back. Of course, I don't know if you really need it, but I did and I leave a note for others. :)

Upvotes: 0

x4rf41
x4rf41

Reputation: 5337

use regex replace with this regex: [^\d] and replace with empty string

press ctrl+f
goto replace tab
check regular expressions
put '[^\d]' in search
press 'replace all'

use this regex if you want to keep line breaks: [^\d\r\n]

Upvotes: 15

Related Questions