C# background regular expression

        static Regex RegPhone = new Regex(@"^((1[34578][0-9]{1}))\d{8}");
        static Regex RegNumber = new Regex(@"^[0-9]+ $");
        static Regex RegNumberSign = new Regex(@"^[+-]?[0-9]+$");
        static Regex RegDecimal = new Regex(@"^[0-9]+[.]?[ 0-9]+$");
        static Regex RegDecimalSign = new Regex(@"^[+-]?[0-9]+[.]?[0-9]+$"); //equivalent to ^ [+-]?\d+[.]?\d+$
        static Regex RegEmail = new Regex(@"^[\\w-]+@[\\w-]+\\.(com|net|org|edu |mil|tv|biz|info)$");//w English letters or numbers, the same syntax as [a-zA-Z0-9]
        static Regex RegCHZN = new Regex(@"[\u4e00-\ u9fa5]");

Example: /// <summary>
        /// Is it a numeric string
        /// </summary>
        /// <param name="inputData">input string</param>
        /// <returns></returns>
        public static bool IsNumber(string inputData)
        {
            Match m = RegNumber.Match(inputData);
            return m.Success;
        }

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324969228&siteId=291194637