public Match_SharpKit Match(string input, int start)
        {
            input = input.Substring(start);
            JsRegExpResult result = m_JSRegex.exec(input);
            Match_SharpKit ret    = new Match_SharpKit(result);

            return(ret);
        }
示例#2
0
		/// <summary>
		/// Converts the specified value.
		/// </summary>
		/// <param name="value">The value.</param>
		/// <exception cref="System.ArgumentNullException"></exception>
		/// <exception cref="System.FormatException"></exception>
		private JsNumber Convert(object value)
		{
			if (value == null)
				throw new ArgumentNullException();

			var regex = new JsRegExp(@"^-?([0-9]+)[^0-9]");
			var match = regex.exec(value.ToString());
			if (match == null)
				throw new FormatException();
			return new JsNumber(match[1].As<double>());
		}
示例#3
0
 // http://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx
 public static float GetIEVersion()
 {
     float rv = -1;
     var appName = navigator.appName;
     string agent = navigator.userAgent;
     if (appName == "Microsoft Internet Explorer")
     {
         var r = new JsRegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})");
         var m = r.exec(agent);
         if (m != null)
         {
             rv = Std.ParseFloat(m[1]);
         }
     }
     return rv;
 }
示例#4
0
 // http://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx
 public static float GetIEVersion()
 {
     float rv = -1;
     var appName = navigator.appName;
     string agent = navigator.userAgent;
     if (appName == "Microsoft Internet Explorer")
     {
         var r = new JsRegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})");
         var m = r.exec(agent);
         if (m != null)
         {
             rv = Std.ParseFloat(m[1]);
         }
     }
     return rv;
 }
示例#5
0
        /// <summary>
        /// Converts the specified value.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <exception cref="System.ArgumentNullException"></exception>
        /// <exception cref="System.FormatException"></exception>
        private JsNumber Convert(object value)
        {
            if (value == null)
            {
                throw new ArgumentNullException();
            }

            var regex = new JsRegExp(@"^-?([0-9]+)[^0-9]");
            var match = regex.exec(value.ToString());

            if (match == null)
            {
                throw new FormatException();
            }
            return(new JsNumber(match[1].As <double>()));
        }
示例#6
0
        /// <summary>
        /// Determines whether the specified value matches the pattern of a valid email address.
        /// </summary>
        ///
        /// <returns>
        /// true if the specified value is valid or null; otherwise, false.
        /// </returns>
        /// <param name="value">The value to validate.</param>
        public override bool IsValid(object value)
        {
            if (value == null)
            {
                return(true);
            }
            var input = value as string;

            if (input != null)
            {
                return(_regex.exec(input) != null);
            }
            else
            {
                return(false);
            }
        }
示例#7
0
 /// <summary>
 /// Checks if the given string is a tuning inticator.
 /// </summary>Checks if the given string is a tuning inticator.
 /// <param name="name"></param>
 /// <returns></returns>
 public static bool IsTuning(string name)
 {
     return(TuningRegex.exec(name) != null);
 }