Skip to content

Commit ab61229

Browse files
committed
Issue #10: fix — include underscore characters in the test for domains.
1 parent fc9badd commit ab61229

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

ghosts

0 Bytes
Binary file not shown.

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (h *Hosts) process() []string {
112112

113113
// step: line match regex for ip address, domain, or host
114114
// This regex matches domain, or host
115-
r, _ := regexp.Compile("((^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$)|((^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(\\s+((?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]\\s*)+$)))")
115+
r, _ := regexp.Compile("((^(?:[a-z_0-9](?:[a-z_0-9-]{0,61}[a-z_0-9])?\\.)+[a-z_0-9][a-z_0-9-]{0,61}[a-z_0-9]$)|((^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(\\s+((?:[a-z_0-9](?:[a-z_0-9-]{0,61}[a-z_0-9])?\\.)+[a-z_0-9][a-z_0-9-]{0,61}[a-z_0-9]\\s*)+$)))")
116116
var matchSlice []string
117117
for i := range slc {
118118
if r.MatchString(slc[i]) {

0 commit comments

Comments
 (0)