Search code examples
notepad++

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


Solution

  • 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]