mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 05:18:58 +00:00
Remove min length regex, the guard is too weak to be meaningful
This commit is contained in:
parent
2e4532ca90
commit
4a6a1308b0
@ -19,9 +19,6 @@ public class GuardedRegexFactory {
|
||||
public static GuardedRegex contains(String substring, @Language("RegExp") String regex) {
|
||||
return new GuardedRegexContains(substring, regex);
|
||||
}
|
||||
public static GuardedRegex minLength(int minLength, @Language("RegExp") String regex) {
|
||||
return new GuardedRegexMinLength(minLength, regex);
|
||||
}
|
||||
|
||||
private record GuardedRegexContains(String contains, Pattern pattern) implements GuardedRegex {
|
||||
public GuardedRegexContains(String contains, String pattern) {
|
||||
@ -32,15 +29,6 @@ public class GuardedRegexFactory {
|
||||
return s.contains(contains) && pattern.matcher(s).find();
|
||||
}
|
||||
}
|
||||
private record GuardedRegexMinLength(int minLength, Pattern pattern) implements GuardedRegex {
|
||||
public GuardedRegexMinLength(int minLength, String pattern) {
|
||||
this(minLength, Pattern.compile(pattern));
|
||||
}
|
||||
|
||||
public boolean test(String s) {
|
||||
return s.length() >= minLength && pattern.matcher(s).find();
|
||||
}
|
||||
}
|
||||
private record GuardedRegexStartsWith(String start, Pattern pattern) implements GuardedRegex {
|
||||
public GuardedRegexStartsWith(String start, String pattern) {
|
||||
this(start, Pattern.compile(pattern));
|
||||
|
Loading…
Reference in New Issue
Block a user