RegexMatcher.MatchRegex C# (CSharp) Method

MatchRegex() public static method

Checks if input matches regex.
public static MatchRegex ( Regex, regex, string input ) : bool
regex Regex,
input string
return bool
    public static bool MatchRegex(this Regex regex, string input) => regex.Match(input).Success;

Same methods

RegexMatcher::MatchRegex ( string input, string regexString ) : bool

Usage Example

コード例 #1
0
ファイル: AccountService.cs プロジェクト: Milvasoft/Milvasoft
        /// <summary>
        /// Regex check for action parameter.
        /// </summary>
        /// <param name="input"></param>
        /// <param name="propName"></param>
        private void CheckRegex(string input, string propName)
        {
            var localizedPattern = _localizer[$"RegexPattern{propName}"];

            if (!RegexMatcher.MatchRegex(input, _localizer[localizedPattern]))
            {
                var exampleFormat = _localizer[$"RegexExample{propName}"];
                throw new MilvaUserFriendlyException("RegexErrorMessage", _localizer[$"Localized{propName}"], exampleFormat);
            }
        }
All Usage Examples Of RegexMatcher::MatchRegex