// email: /^([^0-9\.\+])([\w.\+])+\@(([\w\-])+\.)+[a-zA-Z0-9]{2,}/ // url: /^(http:\/\/)([\w]+\.){1,}[A-Z]{2,}\b/gi // creditcard: /^[0-9]{16}$/gi // ccspecial: /^[0-9]{12}$/gi // cvv: /^[0-9]{3,4}$/gi // phone: /^[0-9]{10}$/gi // postcode: /^[0-9]{4}$/gi // numeric: /^[0-9]+$/gi // alphanumeric: /^[0-9a-f\-\s]+$/gi // dob: /^([0-9]{1,2}[\/]){2}[0-9]{4}$/g // macAddress: /^([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}$/gi // username: /^[a-z0-9\-_\.]{6,12}$/gi // names: /^[a-z\.\-\s\']{1,}$/gi // nonalpha: /[^A-Za-z]+/g // nonalphanumeric: /[^A-Za-z0-9]+/g // nonnumeric: /[^0-9\-\.]/g // nonnumericExplicit: /[^0-9]/g
Sumber: Snipt – Some JS Regexes
Sumber https://www.dte.web.id/