Answer the question
In order to leave comments, you need to log in
Regular expressions, only letters, how to set for German or French or Italian or Ukrainian?
Regular expressions, only letters, how to set for German or French or Italian or Ukrainian? Only letters are needed. For example, for English - [A-Za-z], but what will it be for other languages, who knows, please tell me?
Answer the question
In order to leave comments, you need to log in
Well, as it were: jsfiddle.net/IonDen/k0xhg4c8
var a = "Привет, чувак! 111111";
var b = a.replace(/[^А-Яа-я]/gi, '');
console.log(b); // -> Приветчувак
string text = "Hello, world. Привет мир 123 456 789 [email protected]#t$.%^&*()`☻";
Console.WriteLine("Входная строка: {0}", text);
Regex rex = new Regex(@"\p{L}", RegexOptions.Multiline);
var matches = rex.Matches(text);
StringBuilder textResult = new StringBuilder();
foreach (Match item in matches)
{
textResult.Append(item.Value);
}
Console.WriteLine("Результат: {0}", textResult.ToString());
Console.ReadLine();
string text = "Hello, world. Привет мир 123 456 789 [email protected]#t$.%^&*()`☻";
Console.WriteLine("Входная строка: {0}", text);
Regex regex = new Regex(@"[^\p{L}]", RegexOptions.Multiline);
var textResult = regex.Replace(text, string.Empty);
Console.WriteLine("Результат: {0}", textResult);
Входная строка: Hello, world. Привет мир 123 456 789 [email protected]#t$.%^&*()`☻
Результат: HelloworldПриветмирdfqt
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question