indzi
12/3/2016 - 8:33 AM

Regex for common validations

Regex for common validations

Email Address Uses the regular expression [A‑Z0‑9._%+‑]+@[A‑Z0‑9.‑]
+\.[A‑Z]{2,4}, which matches syntactically valid email addresses (except for case,
but selecting Email Address also automatically marks the expression as case-insensitive,
as explained later in this section)

Phone Number (US) Uses the regular expression [0-9]{3}-?[0-9]{3}-?[0-9]
{4}, which matches U.S. telephone numbers in the format xxx-xxx-xxxx
You can also select any of the following options:

Case Insensitive Rules ignore mismatches due solely to the case of letters.

DotAll Rules allow the dot character in their expressions to match any character,
including line terminators (normally, dot characters do not match line terminators).

Multiline Rules allow the $ and ^ characters to match the beginning and end of lines
(normally, those characters only match the beginning and end of the entire input).

Unicode Case Rules support Unicode characters (normally, rules support only ASCII
characters).

Canon Eq Rules use canon equality, which allows you to use escaped formats for
characters in the regular expression—for example, under canon equality, the expression
\u030A matches the character ?.