Regular expression character matching

Source: Internet
Author: User

Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;

Namespace Zc.common
{
public class Regexpattern
{
Phone or mobile phone number
public static string Phone = @ "(^ (\d{3,4})?-? \d{7,8}$) | (^1[0-9]{10}$) ";
Phone number
public static string telephone = @ "^ (\d{3,4})?-? \d{7,8}$";
Chinese characters
public static string Cn = @ "^[\u4e00-\u9fa5]{0,}$";
Digital
public static string Num = @ "^[\d-]{0,}$";
Include Chinese characters
public static string COTAINCN = @ "[\u4e00-\u9fa5]";
Password
public static string Password = @ "^\w{6,18}$";
E-Mail
public static string Email = @ "^\w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) *$ ";
Qq
public static string Qq = @ "^ ([1-9][0-9]{4}) | ([0-9]{6,10}) $ ";
Url
public static string Url = @ "^http://([\w-]+\.)] +[\w-]+ (/[\w-./?%&=]*)? $ ";
Car Grade
public static string carnumber = @ "^[\u4e00-\u9fa5][a-z]-? [A-z0-9] {5}$ ";
ID number
public static string Idcard = @ "^ (\d{14}|\d{17}) (\d|[ XX]) $ ";
IP Address
public static string Ip = @ "^ (\d{1,2}|1\d\d|2[0-4]\d|25[0-5]). (\d{1,2}|1\d\d|2[0-4]\d|25[0-5]). (\d{1,2}|1\d\d|2[0-4]\d|25[0-5]). (\d{1,2}|1\d\d|2[0-4]\d|25[0-5]) $ ";
Mobile phone number
public static string Mobile = @ "^1[0-9]{10}$";
Chinese name
public static string cnname = @ "[\u3000-\u9fa5\x20]{2,8}";
English name
public static string enname = @ "[a-za-z][\w\-]{2,17}";
User Nickname
public static string nickname = @ "[\u3000-\u9fa5a-za-z][\u3000-\u9fa5\w\-]{1,17}";
Amount
public static string money = @ "\d+[\." \d{0,2} ";
Date
public static string Date = @ "^ (((1[6-9]|[ 2-9]\d) \d{2})-(0?[ 13578]|1[02])-(0?[ 1-9]| [12]\d|3[01]) | (((1[6-9]| [2-9]\d) \d{2})-(0?[ 13456789]|1[012])-(0?[ 1-9]| [12]\d|30)] | (((1[6-9]| [2-9]\d] \d{2}) -0?2-(0?[ 1-9]|1\D|2[0-9]) | (((1[6-9]| [2-9]\d] (0[48]|[ 2468][048]| [13579] [26]) | ((16| [2468] [048]| [3579] [26]) 00)) -0?2-29-)) $ ";

Time
public static string time = @ "^ ([01][0-9]|2[0-3]): [0-5][0-9]:[0-5][0-9]$];

Zip
public static string PostalCode = @ "^[1-9]\d{5}$";
Age
public static string age = @ "1[0-2]\d|\d{1,2}";
Image Address
public static string ImageUrl = "src[^>]*[^/". (?: jpg|bmp|gif) (?:\"| \‘)";
The following please select
public static string pleaseselect = @ "Please select";
}
}

Regular expression character matching

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.