RegEx Pattern

RegEx Pattern

 / open and close
 ^ Begin
 $ End
 ? preceding character
 [] group
 | choice
 + one or more

region-country-state-processid

/^([a-zA-Z]+)-([a-zA-Z]+)-([a-zA-Z]+)-([0-9]+)) $/

How to check valid number / integer?

 "123456" =~ /\A\d+\z/ ? true: false

Username in lowercase, number, underscore or hyphen. minmum 6 and maximum 12 char length.

/^[a-z0-9_-]{6,12}$/

Hex values with length 6 OR 3.

 /^#?([a-f0-9]{6}|[a-f0-9]{3})$/

Name with letters, numbers or hyphens:

 /^[a-z0-9-]+$/

Email

/^([a-z0-9_\.-]+)@([a-z\.-]+)\.([a-z\.]{2,6})$/

URL:

/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/

IP:

/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/

HTML Tag:

/^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/