Skip to content

Commit

Permalink
Anchoring regex to match entire string (Fixes #381)
Browse files Browse the repository at this point in the history
  • Loading branch information
hierynomus committed Nov 13, 2017
1 parent 4ef44e5 commit bdaaa23
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private static class WildcardHostMatcher implements HostMatcher {
private final Pattern pattern;

public WildcardHostMatcher(String hostEntry) {
this.pattern = Pattern.compile(hostEntry.replace("[", "\\[").replace("]", "\\]").replace(".", "\\.").replace("*", ".*").replace("?", "."));
this.pattern = Pattern.compile("^" + hostEntry.replace("[", "\\[").replace("]", "\\]").replace(".", "\\.").replace("*", ".*").replace("?", ".") + "$");
}

@Override
Expand Down

0 comments on commit bdaaa23

Please sign in to comment.