2

I am trying to remove all of the A-z from this string:

aosif$!oias832unaca818

So far, I have

[^A-z]+

However, I need this to not stop once it finds the first match. I thought that's what greedy did :)

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Jamie Hutber
  • 26,790
  • 46
  • 179
  • 291

3 Answers3

6

Mind that [A-z] range also includes some non-letters (see [A-z] and [a-zA-Z] difference).

Use

[A-Za-z]

Replace with empty string.

See demo - result - $!832818

In Notepad++, you may turn off case matching (Match case must be OFF) and then use a simpler [a-z] regex:

enter image description here

Community
  • 1
  • 1
Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
2

try doing this in your editor:

replace all [a-zA-Z] by empty.

you may need switch the regex option on, depends on your editor.

test with sed :

kent$  echo 'aosif$!oias832unaca818'|sed 's/[a-zA-Z]//g'
$!832818
Kent
  • 189,393
  • 32
  • 233
  • 301
1

You mention in the comments your using np++

in the search just put [a-z] replace leave as an empty sting, Check the regex box and uncheck the "match case" box. replace all and you have the required result

exussum
  • 18,275
  • 8
  • 32
  • 65