Regular Expressions 101

Sponsors

Library entries

5
javascript

MAC address

a mac address separated by dashes or colons.
Submitted by anonymous - 7 years ago
5
javascript

password 1upper 1lower 1number 1specialcharater

fjk@1Qaa$
Submitted by Anuswadh - 7 years ago
5
python

Form Tag

Form Tag
Submitted by Jay Patel - 7 years ago
5
python

psswd

no description available
Submitted by anonymous - 7 years ago
5
python

Match Only Text

no description available
Submitted by anonymous - 6 years ago
4
javascript

Repeated words (JS)

no description available
Submitted by paconaranjo - 8 years ago
4
javascript

url matching

supports all major protocols
Submitted by matheus silva - 8 years ago
4
javascript

match brackets outside quotes

no description available
Submitted by Jerry - 7 years ago

html color match: transparent, #fff, #123456, rgb, rgba, hsl, hsla

Vote

11

Regular Expression
javascript

/
^(rgb\s*?\(\s*?(000|0?\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\s*?,\s*?(000|0?\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\s*?,\s*?(000|0?\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\s*?\))$|^(rgba\s*?\(\s*?(000|0?\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\s*?,\s*?(000|0?\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\s*?,\s*?(000|0?\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\s*?,\s*?(0|0\.\d*|1|1.0*)\s*?\))$|^(transparent)$|^(#([a-fA-F0-9]){3})$|^(#([a-fA-F0-9]){6}$)|(^hsl\s*?\(\s*?(000|0?\d{1,2}|[1-2]\d\d|3[0-5]\d|360)\s*?,\s*?(000|100|0?\d{2}|0?0?\d)%\s*?,\s*?(000|100|0?\d{2}|0?0?\d)%\s*?\)$)|(^hsla\s*?\(\s*?(000|0?\d{1,2}|[1-2]\d\d|3[0-5]\d|360)\s*?,\s*?(000|100|0?\d{2}|0?0?\d)%\s*?,\s*?(000|100|0?\d{2}|0?0?\d)%\s*?,\s*?(0|0\.\d*|1|1.0*)\s*?\)$)$
/

Description

Loading markdown...
Submitted by grouch - 8 years ago