public Regex(String pattern, RegexSyntax syntax) { if (pattern == null) { throw new ArgumentNullException("pattern"); } this.syntax = syntax; if ((syntax & RegexSyntax.IgnoreCase) != 0) { pattern = pattern.ToLower(); } if ((syntax & RegexSyntax.Wildcard) != 0) { pattern = FileSystemToPosix(pattern); syntax = RegexSyntax.PosixExtended; } syntax &= (RegexSyntax.All & ~(RegexSyntax.Debug | RegexSyntax.IgnoreCase)); lock (typeof(Regex)) { // We lock down "Regex" while we do this because the // syntax setting in the GNU regex routines is not // thread-safe without it. handle = RegexpMethods.CompileWithSyntaxInternal (pattern, (int)syntax); } if (handle == IntPtr.Zero) { throw new ArgumentException(_("Arg_InvalidRegex")); } }
public Regex(String pattern, RegexSyntax syntax) { if(pattern == null) { throw new ArgumentNullException("pattern"); } this.syntax = syntax; if((syntax & RegexSyntax.IgnoreCase) != 0) { pattern = pattern.ToLower(); } if((syntax & RegexSyntax.Wildcard) != 0) { pattern = FileSystemToPosix(pattern); syntax = RegexSyntax.PosixExtended; } syntax &= (RegexSyntax.All & ~(RegexSyntax.Debug | RegexSyntax.IgnoreCase)); lock(typeof(Regex)) { // We lock down "Regex" while we do this because the // syntax setting in the GNU regex routines is not // thread-safe without it. handle = RegexpMethods.CompileWithSyntaxInternal (pattern, (int)syntax); } if(handle == IntPtr.Zero) { throw new ArgumentException(S._("Arg_InvalidRegex")); } }