Skip to content

Commit

Permalink
add support for case insensitive refanging and update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewarren committed May 2, 2018
1 parent fbba001 commit 19553ec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion refang.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func Refang(input interface{}) (string, error) {
return "", errors.New("unknown type")
}

re := regexp.MustCompile(`^(?:hxxp|nsfw|evil|meow)`)
re := regexp.MustCompile(`(?i)^(?:hxxp|nsfw|evil|meow)`)

output = re.ReplaceAllString(output, "http")

Expand Down
1 change: 1 addition & 0 deletions refang_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func TestRefang(t *testing.T) {
wantErr bool
}{
{"simple http", args{"hxxp://google[.]com"}, "http://google.com", false},
{"simple http 2", args{"hXXp://google[.]com"}, "http://google.com", false},
{"simple https", args{"hxxps://google[.]com"}, "https://google.com", false},
{"meow", args{"meows://google[.]com"}, "https://google.com", false},
{"dots", args{"hxxps://google(.)com"}, "https://google.com", false},
Expand Down

0 comments on commit 19553ec

Please sign in to comment.