L
L
LiptonOlolo2020-05-18 23:58:09
Regular Expressions
LiptonOlolo, 2020-05-18 23:58:09

How to remove everything but letters?

Let's say we have a string: "ПРИВЕТ!!!2222312HELLO MY NAME IS habr!!".
How to get from such a string "ПРИВЕТHELLOMYNAMEIShabr"using a regular expression?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
0
0xD34F, 2020-05-19
@LiptonOlolo

Regex.Replace(str, "(?i)[^А-ЯЁA-Z]", "")

C
Collin, 2020-05-19
@Collin

It is worth looking here to fix it:
https://docs.microsoft.com/ru-ru/dotnet/standard/b...
https://habr.com/ru/company/otus/blog/469989/
https:// metanit.com/sharp/tutorial/7.4.php

#
#, 2020-05-19
@mindtester

for a change https://ideone.com/h7RtVy

D
d-stream, 2020-05-19
@d-stream

Why not immediately use complex neural networks?
Why is Replace objectionable?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question