How to delete all characters except numbers in notepad ++? Looking for regular expressions?

Example:

"": ",,-, ,,❤\🎈\ :\ ( ) +380958795928",

  • 2
    You will not believe /[^\d]/ - Peresada
  • Does not work in notepad + - Cruze Fan
  • @CruzeFan, remove slashes and everything will work - [^\d] - MedvedevDev
  • Yes, now it works, but I did not take into account that now all the numbers have merged into one numbers and not in rows ... - Cruze Fan
  • Is not + needed? - And

3 answers 3

Yes, regular expressions are needed.

From the menu choose:

Поиск | Замена... Поиск | Замена... (or just Ctrl + H )

  • Search mode: Регуляр. выражен. Регуляр. выражен.
  • Find: \D
  • Replace with: (empty - do not write anything)

The regular expression \D means: "any character except a digit". All such characters will be replaced with empty characters , i.e. they will disappear.

enter image description here

    [^\d\s]

    The \s representation is a shortened version of all whitespace characters [ \t\n\r\f\v]

    Then you will have spaces, tabs, newline, etc.

    • one
      Are you sure about \S ? Have you checked it? - simpleCode pm
    • I apologize for \s . Corrected the answer - Vladimir Afanasyev
    • That's better. Even better - [\D\S] . That is, the opposite and one less sign. But it is up to you. - simpleCode

    \D - all but numbers. Check https://regex101.com/r/mTIbIB/1

    • is) just open the notepad ++ and check. if you are the moderator of this section, do the answer as you see fit. - mazzy pm
    • let it be so, but be so kind as to give an answer full and clear - AR Hovsepyan