From dbd65cccbc6d38f6daa51ac39d8f97430d405988 Mon Sep 17 00:00:00 2001 From: rucas Date: Tue, 5 Mar 2019 16:01:59 -0800 Subject: [PATCH] better SSN regex * does not allow 00 group number * does not allow 0000 serial number --- regexes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regexes.go b/regexes.go index 3f79c61..e61d02f 100644 --- a/regexes.go +++ b/regexes.go @@ -34,7 +34,7 @@ const ( dataURIRegexString = "^data:.+\\/(.+);base64$" latitudeRegexString = "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)$" longitudeRegexString = "^[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$" - sSNRegexString = `^\d{3}[- ]?\d{2}[- ]?\d{4}$` + sSNRegexString = `^[0-9]{3}[ -]?(0[1-9]|[1-9][0-9])[ -]?([1-9][0-9]{3}|[0-9][1-9][0-9]{2}|[0-9]{2}[1-9][0-9]|[0-9]{3}[1-9])$` hostnameRegexStringRFC952 = `^[a-zA-Z][a-zA-Z0-9\-\.]+[a-z-Az0-9]$` // https://tools.ietf.org/html/rfc952 hostnameRegexStringRFC1123 = `^[a-zA-Z0-9][a-zA-Z0-9\-\.]+[a-z-Az0-9]$` // accepts hostname starting with a digit https://tools.ietf.org/html/rfc1123 btcAddressRegexString = `^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$` // bitcoin address