public static string SetRegexOptions(string options) { RegexOptions newRegexOptions = RegexOptions.None; RegexSyntaxModes newRegexSyntaxModes = RegexSyntaxModes.POSIXExtendedRegex; foreach (char c in options) { switch (c) { case 'i': newRegexOptions |= RegexOptions.AmbiguityMatch; break; case 'x': newRegexOptions |= RegexOptions.ExtendedPatternForm; break; case 'm': newRegexOptions |= RegexOptions.DotMatchesNewLine; break; case 's': newRegexOptions |= RegexOptions.ConvertMatchBeginEnd; break; case 'p': newRegexOptions |= RegexOptions.DotMatchesNewLine | RegexOptions.ConvertMatchBeginEnd; break; case 'l': newRegexOptions |= RegexOptions.FindLongestMatch; break; case 'n': newRegexOptions |= RegexOptions.IgnoreEmptyMatch; break; case 'e': newRegexOptions |= RegexOptions.EvalResultingCode; break; case 'd': newRegexSyntaxModes = RegexSyntaxModes.POSIXExtendedRegex; break; default: PhpException.ArgumentValueNotSupported("options", c); break; } } // _regexOptions = newRegexOptions; _regexSyntaxMode = newRegexSyntaxModes; return(GetRegexOptions()); }
/// <summary> /// Determines if given syntax mode is set. /// </summary> /// <param name="opt">Syntax mode to test.</param> /// <returns>True if given syntax mode is enabled.</returns> private static bool OptionEnabled(RegexSyntaxModes opt) { return(_regexSyntaxMode == opt); }
/// <summary> /// Determines if given syntax mode is set. /// </summary> /// <param name="opt">Syntax mode to test.</param> /// <returns>True if given syntax mode is enabled.</returns> private static bool OptionEnabled(RegexSyntaxModes opt) { return (_regexSyntaxMode == opt); }
public static string SetRegexOptions(string options) { RegexOptions newRegexOptions = RegexOptions.None; RegexSyntaxModes newRegexSyntaxModes = RegexSyntaxModes.POSIXExtendedRegex; foreach (char c in options) { switch (c) { case 'i': newRegexOptions |= RegexOptions.AmbiguityMatch; break; case 'x': newRegexOptions |= RegexOptions.ExtendedPatternForm; break; case 'm': newRegexOptions |= RegexOptions.DotMatchesNewLine; break; case 's': newRegexOptions |= RegexOptions.ConvertMatchBeginEnd; break; case 'p': newRegexOptions |= RegexOptions.DotMatchesNewLine | RegexOptions.ConvertMatchBeginEnd; break; case 'l': newRegexOptions |= RegexOptions.FindLongestMatch; break; case 'n': newRegexOptions |= RegexOptions.IgnoreEmptyMatch; break; case 'e': newRegexOptions |= RegexOptions.EvalResultingCode; break; case 'd': newRegexSyntaxModes = RegexSyntaxModes.POSIXExtendedRegex; break; default: PhpException.ArgumentValueNotSupported("options", c); break; } } // _regexOptions = newRegexOptions; _regexSyntaxMode = newRegexSyntaxModes; return GetRegexOptions(); }
/// <summary> /// Determines if given syntax mode is set. /// </summary> /// <param name="opt">Syntax mode to test.</param> /// <returns>True if given syntax mode is enabled.</returns> private static bool OptionEnabled(RegexSyntaxModes opt) { return (StaticInfo.Get.RegexSyntaxMode == opt); }