Skip to content

Commit

Permalink
refactor: improve regex
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
  • Loading branch information
caarlos0 committed Dec 24, 2021
1 parent a77fe55 commit 4281783
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion internal/whois/whois.go
Original file line number Diff line number Diff line change
Expand Up @@ -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: (.*)`)
)

Expand Down

0 comments on commit 4281783

Please sign in to comment.