Skip to content

Commit

Permalink
chore: Replace .^ pattern with alphanumeric plus
Browse files Browse the repository at this point in the history
  • Loading branch information
en-milie committed Sep 23, 2024
1 parent 9edff39 commit bcbb7e3
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class StringGenerator {
private static final Pattern HAS_LENGTH_PATTERN = Pattern.compile("(\\*|\\+|\\?|\\{\\d+(,\\d*)?\\})");

private static final Pattern LENGTH_INLINE_PATTERN = Pattern.compile("(\\^)?(\\[[^]]*]\\{\\d+}|\\(\\[[^]]*]\\{\\d+}\\)\\?)*(\\$)?");
private static final List<String> WILD_CARDS = List.of(".^");

private static final String ALPHANUMERIC = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
private static final String[] DOMAINS = {"example", "cats", "google", "yahoo"};
Expand Down Expand Up @@ -231,6 +232,9 @@ public static String cleanPattern(String pattern) {
if (StringUtils.isBlank(pattern)) {
return ALPHANUMERIC_PLUS;
}
if (WILD_CARDS.contains(pattern)) {
return ALPHANUMERIC_PLUS;
}
if (pattern.startsWith("/") && pattern.endsWith("/i")) {
pattern = pattern.substring(1, pattern.length() - 2);
}
Expand Down

0 comments on commit bcbb7e3

Please sign in to comment.