示例#1
0
 // Determine if a string matches this regular expression and return
 // all of the matches in an array.  Returns null if no match.
 public RegexMatch[] Match(String str, RegexMatchOptions options,
                           int maxMatches)
 {
     if (str == null)
     {
         throw new ArgumentNullException("str");
     }
     else if (maxMatches < 0)
     {
         throw new ArgumentOutOfRangeException
                   ("maxMatches", "Must be non-negative");
     }
     if ((syntax & RegexSyntax.IgnoreCase) != 0)
     {
         str = str.ToLower();
     }
     lock (this)
     {
         if (handle != IntPtr.Zero)
         {
             options &= RegexMatchOptions.All;
             return((RegexMatch[])RegexpMethods.MatchInternal
                        (handle, str, maxMatches, (int)options,
                        typeof(RegexMatch)));
         }
         else
         {
             throw new ObjectDisposedException
                       (_("Exception_Disposed"));
         }
     }
 }
示例#2
0
 public bool Match(String str, RegexMatchOptions options)
 {
     if (str == null)
     {
         throw new ArgumentNullException("str");
     }
     if ((syntax & RegexSyntax.IgnoreCase) != 0)
     {
         str = str.ToLower();
     }
     lock (this)
     {
         if (handle != IntPtr.Zero)
         {
             options &= RegexMatchOptions.All;
             return(RegexpMethods.ExecInternal
                        (handle, str, (int)options) == 0);
         }
         else
         {
             throw new ObjectDisposedException
                       (_("Exception_Disposed"));
         }
     }
 }
示例#3
0
	// Determine if a string matches this regular expression and return
	// all of the matches in an array.  Returns null if no match.
	public RegexMatch[] Match(String str, RegexMatchOptions options,
						      int maxMatches)
			{
				if(str == null)
				{
					throw new ArgumentNullException("str");
				}
				else if(maxMatches < 0)
				{
					throw new ArgumentOutOfRangeException
						("maxMatches", "Must be non-negative");
				}
				if((syntax & RegexSyntax.IgnoreCase) != 0)
				{
					str = str.ToLower();
				}
				lock(this)
				{
					if(handle != IntPtr.Zero)
					{
						options &= RegexMatchOptions.All;
						return (RegexMatch[])RegexpMethods.MatchInternal
							(handle, str, maxMatches, (int)options,
							 typeof(RegexMatch));
					}
					else
					{
						throw new ObjectDisposedException
							(S._("Exception_Disposed"));
					}
				}
			}
示例#4
0
	public bool Match(String str, RegexMatchOptions options)
			{
				if(str == null)
				{
					throw new ArgumentNullException("str");
				}
				if((syntax & RegexSyntax.IgnoreCase) != 0)
				{
					str = str.ToLower();
				}
				lock(this)
				{
					if(handle != IntPtr.Zero)
					{
						options &= RegexMatchOptions.All;
						return (RegexpMethods.ExecInternal
									(handle, str, (int)options) == 0);
					}
					else
					{
						throw new ObjectDisposedException
							(S._("Exception_Disposed"));
					}
				}
			}