unclean SPARC
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
if(!app.helpers) app.helpers = {}
|
||||
/**
|
||||
* Helper to centralize regexps for usual data validations.
|
||||
* @category MyEic
|
||||
* @subcategory Helpers
|
||||
*/
|
||||
app.helpers.validators = {
|
||||
validators : class {
|
||||
/*********************** All Regexp (for eventual direct use **********************/
|
||||
static mailRFC5322Regex = /^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/
|
||||
static mustacheTokenRegex = new RegExp(/\{\{([\w\-\.\^\#\/]+)\}\}/,'gm')
|
||||
|
||||
|
||||
|
||||
/*********************** All validators **********************/
|
||||
static isValidEmail(text){
|
||||
return(text.match(this.mailRFC5322Regex))
|
||||
}
|
||||
|
||||
static isValidMustacheToken(text){
|
||||
return(text.match(this.mustacheTokenRegex))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user