Private Static RegEx regphone = new RegEx ("^ [0-9] + [-]? [0-9] + [-]? [0-9] {1} $ "); Private Static RegEx regnumber = new RegEx (" ^ [0-9] + {1} $ "); private Static RegEx regnumbersign = new RegEx ("^ [+-]? [0-9] + {1} $ "); Private Static RegEx regdecimal = new RegEx (" ^ [0-9] + [.]? [0-9] + {1} $ "); Private Static RegEx regdecimalsign = new RegEx (" ^ [+-]? [0-9] + [.]? [0-9] + {1} $ "); // equivalent to ^ [+-]? \ D + [.]? \ D + $ Private Static RegEx regemail = new RegEx ("^ [\ W-] + @ [\ W-] + \\. (COM | net | org | Edu | mil | TV | biz | info) {1} $ "); // a string of W English letters or numbers, like the [a-zA-Z0-9] syntax, Private Static RegEx regchzn = new RegEx ("[\ u4e00-\ u9fa5]"); // Chinese
Example:
# Region Chinese detection // <summary> /// check whether there are any Chinese characters // </Summary> // <Param name = "inputdata"> </param> /// <returns> </returns> Public static bool ishaschzn (string inputdata) {Match m = regchzn. match (inputdata); Return M. success;} # endregion