Last active
March 4, 2017 14:39
-
-
Save nvurgaft/1af2c0be26c020c9dc757f82d92a5279 to your computer and use it in GitHub Desktop.
list of self authored regular repressions for common uses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\b[0-9a-f]{32}\b | |
This expression will stricly match an MD5 string | |
"d41d8cd98f00b204e9800998ecf8427e" will match | |
\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b | |
This expression will stricly match a canonical UUID string | |
"123e4567-e89b-12d3-a456-426655440000" will match | |
"123e4567-e89b-12d3-a456-426655440000a" will not | |
"123e4567e89b12d3a456426655440000" will also not match | |
\b((([0-9a-f]{2}:)){5}|(([0-9a-f]{2}-)){5})[0-9a-f]{2}\b/i | |
will test a string if it's a valid mac address | |
"19-2c-10-0c-dd-00" will match | |
"19:2c:10:0c:dd:00" will also match | |
"19:2c:10-0c:dd:00" however this will not match | |
\b((((\d|[1-9]\d|1\d{2}|2[0-4][0-5]|25[0-5])\.){3})(\d|[1-9]\d|1\d{2}|2[0-4][0-5]|25[0-5]))(\/(\d|[1-2]\d|3[0-1]))?\b | |
This expression will strictly match a valid IPv4 address | |
"127.0.0.1" will match | |
"127.0.0.-1" will not match | |
"127.256.0.1" will also not match | |
\b([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}\b | |
This expression will strictly match a valid IPv6 address | |
"2001:0db8:0000:00f0:0000:ff00:0042:8329" will match | |
"2001:0db8:0000:f0:0000:ff00:42:8329" will also match |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment