Description
Returns true if the defined 'regex' pattern has a match within the specified 'string' else false.
Signature
RegexIsMatch('string', «regex»)
Example 1
RegexIsMatch('abcdefg', «^abc») Returns True
Example 2
Validates an email address
RegexIsMatch('Email address',
«^[\w-]+(\.[\w-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$»
)
Example 3
Validates an Uri
RegexIsMatch('Uri',
«(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?»
)
Example 4
Validates any whole or decimal number
RegexIsMatch('Any whole or decimal number',
«^([0-9]*|\d*\.\d{1}?\d*)$»
)
Example 5
Validates US Currency
RegexIsMatch('US Currency', «^\$(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$» )
Example 6
Validates one numeric digit
RegexIsMatch('One numeric digit', «^\d$»)
Example 7
Validates a percentage to 2 decimal places
RegexIsMatch('A percentage to 2 decimal places ', «^( 100(?:\.0{1,2})? | 0*?\.\d{1,2} | \d{1,2}(?:\.\d{1,2})? )% $» )
Example 8
Validates a password must be at least 8 characters, no more than 15 characters, and must include at least one upper case letter, one lower case letter, and one numeric digit
RegexIsMatch('A password must be at least 8 characters, no more than 15 characters, and must include at least one upper case letter, one lower case letter, and one numeric digit', «^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,15}$» )
Example 9
Validates a UK vehicle registration
RegexIsMatch('A UK vehicle registration', «^([A-Z]{3}\s?(\d{3}|\d{2}|d{1})\s?[A-Z])|([A-Z]\s?(\d{3}|\d{2}|\d{1})\s?[A-Z]{3})|(([A-HK-PRSVWY][A-HJ-PR-Y])\s?([0][2-9]|[1-9][0-9])\s?[A-HJ-PR-Z]{3})$» )
Example 10
Validates alpha numeric values
RegexIsMatch('Alpha numberic values', «^[a-zA-Z0-9]+$»)
Example 11
Validates a UK National Insurance Number
RegexIsMatch('A UK National Insurance Number', «^[A-CEGHJ-PR-TW-Z]{1}[A-CEGHJ-NPR-TW-Z]{1}[0-9]{6}[A-DFM]{0,1}$» )
Example 12
Validates credit card numbers
RegexIsMatch('Credit card numbers', «^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$» )
Example 13
Validates US telephone numbers
RegexIsMatch('US telephone numbers', «^[01]?[- .]?\(?[2-9]\d{2}\)?[- .]?\d{3}[- .]?\d{4}$» )
Example 14
Validates US Zip Codes
RegexIsMatch('US Zip Codes', «(^(?!0{5})(\d{5})(?!-?0{4})(-?\d{4})?$)» )
Example 15
Validates German Post Codes
RegexIsMatch('German Post Codes', «\b((?:0[1-46-9]\d{3})|(?:[1-357-9]\d{4})|(?:[4][0-24-9]\d{3})|(?:[6][013-9]\d{3}))\b» )
Example 16
Validates UK Post Codes
RegexIsMatch('UK Post Codes', «^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$» )
Example 17
Validates UK Telephone Number
RegexIsMatch('UK Telephone Number', «(\s*\(?0\d{4}\)?(\s*|-)\d{3}(\s*|-)\d{3}\s*)|(\s*\(?0\d{3}\)?(\s*|-)\d{3}(\s*|-)\d{4}\s*)|(\s*(7|8)(\d{7}|\d{3}(\-|\s{1})\d{4})\s*)» )
Example 18
Validates US Telephone Number
RegexIsMatch('US Telephone Number', «^([0-9]( |-)?)?(\(?[0-9]{3}\)?|[0-9]{3})( |-)?([0-9]{3}( |-)?[0-9]{4}|[a-zA-Z0-9]{7})$» )
Example 19
Validates date of birth (MM/DD/YYYY)
RegexIsMatch('Date of birth (MM/DD/YYYY)', «^((0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2})*$» )
Example 20
Validates for digits only
RegexIsMatch('Digits only', «^[0-9]*$»)
Example 21
Validates US social security numbers
RegexIsMatch('US social security number', «/^([0-9]{3}[-]*[0-9]{2}[-]*[0-9]{4})*$/»)
Parameters
Name | Type | Description | Required |
---|---|---|---|
string | xxxx | xxxx | xxxx |
«regex» | xxxx | xxxx | xxxx |