src/NuGetGallery.Core/Extensions/RegexEx.cs
/// <summary>
/// Searches the input string for the first occurrence of the specified regular expression,
/// using the specified matching options and the default time-out interval.
/// </summary>
/// <param name="input">The string to search for a match.</param>
/// <param name="pattern">The regular expression pattern to match.</param>
/// <param name="options">A bitwise combination of the enumeration values that provide options for matching.</param>
/// <returns>An object that contains information about the match, or <c>null</c> if and only if the match timed out.</returns>
Searches the input string for the first occurrence of the specified regular expression,
using the specified matching options and the default time-out interval.
Searches the input string for the first occurrence of the specified regular expression using the specified matching options and the default time - out interval .
public static Match MatchWithTimeoutOrNull(
            string input,
            string pattern,
            RegexOptions options)
        {
            try
            {
                return Regex.Match(input, pattern, options, Timeout);
            }
            catch (RegexMatchTimeoutException)
            {
                return null;
            }
        }
public static Match MatchWithTimeoutOrNull ( string input , string pattern , RegexOptions options ) { try { return Regex . Match ( input , pattern , options , Timeout ) ; } catch ( RegexMatchTimeoutException ) { return null ; } }
Searches the input string for the first occurrence of the specified regular expression,
using the specified matching options and the default time-out interval.
Searches the input string for the first occurrence of the specified regular expression using the specified matching options and the default time - out interval .
An object that contains information about the match, or null
An object that contains information about the match or null
input
string
The string to search for a match.
The string to search for a match .
pattern
string
The regular expression pattern to match.
The regular expression pattern to match .
options
RegexOptions
A bitwise combination of the enumeration values that provide options for matching.
A bitwise combination of the enumeration values that provide options for matching .