-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation
Vijendra Kumar S K edited this page Jul 30, 2017
·
8 revisions
Regular Expression custom methods can be used to pass multiple values in array object or a literal if it is only one value
Just <script src="regx.js"></script> is enough.
Start using regx methods and properties just by regx. and it would return Boolean value based on the Regular Expression test method.
You can supply optional args that are prebound to the function.
regx.text({check:val,include:['+','*'],exclude:'%',case:'ignore',whitespace:false}); regx.text(val);Regx.Text (object | literal value)
Param | Type | Details |
---|---|---|
literal value | string | A value to check whether it is text |
object | object | Properties to provide customized regular expression validation |
Properties in Object | ||
check | string | Value to validate |
include | optional string or Array e.g : ['+','*'] or '+-*' | set of characters,symbols,digits need to be considered while validating |
exclude | optional string or Array e.g : ['+','*'] or '+-*' | set of characters,symbols,digits should not be considered while validating |
case | lower or upper or ignore | case type to be considered while validating |
whitespace | true or false | include or exclude whitespace while validating |
You can supply optional args that are prebound to the function.
regx.number({check:val,comma:true,startingdecimal:true, integer:{length:3},decimals:{length:2,optional:true},sign:{show:true,optional:true},currency:{sign:'$',optional:true},brackets:{show:true,optional:true}}); regx.number(val);Regx.Number (object | value)
Param | Type | Details |
---|---|---|
value | number | A value to check whether it is number |
object | object | Properties to provide customized regular expression validation |
Properties in Object | ||
check | string | Value to validate |
startingdecimal | true or false | to consider or not number starting with decimal |
integer | object having "length" as property | contains "length" property to consider length of the integer |
decimals | object having "length" and "optional" as property |
length : length of the decimals to be considered optional : true or false |
sign | object having "show" and "optional" as property |
consider currency symbol in the value or not show : true or false optional : true or false |
currency | object having "sign" and "optional" as property |
consider currency type symbol in the value or not show : true or false optional : true or false |
brackets | object having "show" and "optional" as property |
consider brackets in the value or not show : true or false optional : true or false |
comma | true or false | consider comma "," in the value or not |
You can supply optional args that are prebound to the function.
regx.mac({check:val,delimiter:[]}); regx.mac(value)Regx.Mac (object | value)
Param | Type | Details |
---|---|---|
value | number | A value to check whether it is valid MAC address |
object | object | Properties to provide customized regular expression validation |
Properties in Object | ||
check | string | MAC address to validate |
delimiter | delimiter type,octect separator symbol type | to consider the delimiter type |
You can supply optional args that are prebound to the function.
regx.email({check:val,identifier:{has:[],include:{elements:[],optional:true},exclude:{elements:[],optional:true}},domain:{name:'gmail'},tld:{type:['com','co']}}); regx.email(value)Regx.Email (object | value)
Param | Type | Details |
---|---|---|
value | number | A value to check whether it is valid Email Address |
object | object | Properties to provide customized regular expression validation |
Properties in Object | ||
check | string | Email address to validate |
identifier | Optional Object having properties "has", "include", "exclude", "domain" and "tld" |
has : Array of values which can be considered for email address e.g has:["vijay","kumar","something"] include : Object having "elements" and "optional" properties include.elements : Array of characters/symbols need to considered in email e.g. elements:['$','&'] include.optional : true of false exclude : Object having "elements" and "optional" properties exclude.elements : Array of characters/symbols should not be considered in email e.g. elements:['$','&'] exclude.optional : true of false domain : Object having "name" property domain.name : Domain name should be considered in email e.g. domain:{name:'gmail'} tld : Top level domain need to be considered tld.type : Array of tld e.g. tld:{type:['com','co']} |