From 4281783be2555d2703876abff75ac1935cae0812 Mon Sep 17 00:00:00 2001 From: Carlos A Becker Date: Fri, 24 Dec 2021 17:53:23 -0300 Subject: [PATCH] refactor: improve regex Signed-off-by: Carlos A Becker --- internal/whois/whois.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/internal/whois/whois.go b/internal/whois/whois.go index 0ee5e7a..3c0d76d 100644 --- a/internal/whois/whois.go +++ b/internal/whois/whois.go @@ -52,7 +52,25 @@ var ( } // nolint: lll - expiryRE = regexp.MustCompile(`(?i)(Registrar Registration Expiration Date|expire-date|Valid Until|Expire Date|Registry Expiry Date|paid-till|Expiration Date|Expiration Time|Expiry date|Expiry|Expires On|expires|Expires|expire|Renewal Date|Record expires on|Exp date)\]?:?\s?(.*)`) + expiryRE = regexp.MustCompile(`(?i)(` + strings.Join([]string{ + "Registrar Registration Expiration Date", + "expire-date", + "Valid Until", + "Expire Date", + "Registry Expiry Date", + "paid-till", + "Expiration Date", + "Expiration Time", + "Expiry date", + "Expiry", + "Expires On", + "expires", + "Expires", + "expire", + "Renewal Date", + "Record expires on", + "Exp date", + }, "|") + `)\]?:?\s?(.*)`) registrarRE = regexp.MustCompile(`(?i)Registrar WHOIS Server: (.*)`) )