Example #1
0
		internal  Match exec(string str, int start, int off)
		{
			if (ignoreCase)
			{
				str = str.ToLower();
			}
			
			Match match = new Match();
			
			match.program = program;
			
			/* Mark beginning of line for ^ . */
			match.str = str;
			match.bol = start;
			match.length = str.Length;
			
			match.indices = new int[npar * 2];
			
			if (anchored)
			{
				/* Simplest case:  anchored match need be tried only once. */
				if (match.regtry(off))
				{
					return match;
				}
			}
			else if (startChar >= 0)
			{
				/* We know what char it must start with. */
				while (off < match.length)
				{
					off = str.IndexOf((System.Char) startChar, off);
					if (off < 0)
					{
						break;
					}
					if (match.regtry(off))
					{
						return match;
					}
					off++;
				}
			}
			else
			{
				/* Messy cases:  unanchored match. */
				do 
				{
					if (match.regtry(off))
					{
						return match;
					}
				}
				while (off++ < match.length);
			}
			return null;
		}