Created
April 27, 2012 09:07
-
-
Save anonymous/2507667 to your computer and use it in GitHub Desktop.
RegExp creation
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
var REGEX = { | |
NUMBER : /^-?[0-9]*\.?[0-9]+$/, | |
KEYWORD : /^(?:top\s+|bottom\s+)?(?:right|left)|(?:right\s+|left\s+)?(?:top|bottom)$/ | |
}; | |
var direction = RegExp([ | |
'^(?:', | |
REGEX.NUMBER.source.slice(1, -1), | |
'|', | |
'(?:', REGEX.KEYWORD.source.slice(1, -1), ')deg', | |
'|', | |
0, | |
')$'].join('')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment