Few common POSIX Regular Expression

Following POSIX Regular Expression will be needed commonly while developing application,

ALPHA_REG_EXPRESSION = "[a-zA-Z ]*"

ALPHA_UNDERSCORE_REG_EXPRESSION = "[a-zA-Z_ ]*"

ALPHA_NUMERIC_REG_EXPRESSION = "[a-zA-Z0-9 ]*"

ALPHA_NUMERIC_UNDERSCORE_REG_EXPRESSION = "[a-zA-Z0-9_ ]*"

ALPHA_NUMERIC_UNDERSCORE_DASH_REG_EXPRESSION = "[a-zA-Z0-9_[-] ]*"

DECIMAL_REG_EXPRESSION = "[0-9]*[.][0-9]*"

INTEGER_REG_EXPRESSION = "([1-9][0-9]*)|0"

ADDRESS_REG_EXPRESSION = "[,.#_a-zA-Z0-9- ]*"

IP_REG_EXPRESSION = "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"

EMAIL_REG_EXPRESSION = "[a-zA-Z0-9._]*@[a-zA-Z0-9 ]*.[a-zA-Z]*"

EMAIL_REG_EXPRESSION = "\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}\\b"

MAC_REG_EXPREESION = "([0-9a-fA-F][0-9a-fA-F]-){5}([0-9a-fA-F][0-9a-fA-F])"

MAC_REG_EXPREESION = "[0-9A-Fa-f[-] ]*"

ZIPCODE_REG_EXPRESSION = "([0-9a-zA-Z]{5})|([0-9a-zA-Z]{7})|([0-9a-zA-Z]{9})|([0-9a-zA-Z]{11})"

NUMERIC_DASH_REG_EXPRESSION = "[0-9- ]*"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s