20230813-1
This commit is contained in:
parent
e6b2c3f0a1
commit
7fad80bae1
@ -115,20 +115,14 @@ public static class TextFormatter
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text">Текст на проверку</param>
|
/// <param name="text">Текст на проверку</param>
|
||||||
/// <param name="pattern">Шаблон</param>
|
/// <param name="pattern">Шаблон</param>
|
||||||
/// <param name="options">Параметры проверки в формате <see cref="RegexOptions"/> (можно игнорировать, по умолчанию: <see cref="RegexOptions.None"/>)</param>
|
/// <param name="options">Параметры проверки в формате <see cref="RegexOptions"/> (можно игнорировать, по умолчанию: <see cref="RegexOptions.IgnoreCase"/>)</param>
|
||||||
/// <returns>Есть ли совпадения в тексте</returns>
|
/// <returns>Есть ли совпадения в тексте</returns>
|
||||||
public static bool IsMatchRegExp (string text, string pattern, RegexOptions? options = null)
|
public static bool IsMatchRegExp (string text, string pattern, RegexOptions? options = null)
|
||||||
{
|
{
|
||||||
// Задаю настройки проверки регулярных выражений
|
// Задаю настройки проверки регулярных выражений
|
||||||
RegexOptions regexOptions = options ?? RegexOptions.None;
|
RegexOptions regexOptions = options ?? RegexOptions.IgnoreCase;
|
||||||
|
|
||||||
// Создаю класс для проверки выражения
|
|
||||||
Regex regex = new Regex(pattern, regexOptions);
|
|
||||||
|
|
||||||
// Получаю совпадения
|
|
||||||
MatchCollection matches = regex.Matches(text);
|
|
||||||
|
|
||||||
// Возвращаю результат
|
// Возвращаю результат
|
||||||
return matches.Count > 0;
|
return Regex.IsMatch(text, pattern, regexOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<Version>2023.813.0</Version>
|
<Version>2023.813.1</Version>
|
||||||
<Authors>Александр Бабаев</Authors>
|
<Authors>Александр Бабаев</Authors>
|
||||||
<Product>Набор компонентов ANB Software</Product>
|
<Product>Набор компонентов ANB Software</Product>
|
||||||
<Description>Библиотека полезных методов языка C#</Description>
|
<Description>Библиотека полезных методов языка C#</Description>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user