Adding regex tool
This commit is contained in:
parent
719ab8a02e
commit
9041f3a804
1
tools/ProfanityFilter/.vscode/launch.json
vendored
1
tools/ProfanityFilter/.vscode/launch.json
vendored
@ -4,7 +4,6 @@
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Current File",
|
||||
|
@ -9,16 +9,24 @@ public class ExceptionGenerator {
|
||||
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
args[i] = "$" + args[i] + "$";
|
||||
for (String str : args[i].toLowerCase().split(base)) {
|
||||
if (str.equals("$")) {
|
||||
|
||||
} else {
|
||||
str.replaceAll("$", "");
|
||||
|
||||
}
|
||||
|
||||
String prefix = args[i].toLowerCase().split(base)[0];
|
||||
|
||||
String suffix = args[i].toLowerCase().split(base)[1];
|
||||
|
||||
if (!prefix.equals("$")) {
|
||||
prefixes += RegexGenerator.regexGenerator(prefix) + "|";
|
||||
}
|
||||
|
||||
if (!suffix.equals("$")) {
|
||||
suffixes += RegexGenerator.regexGenerator(suffix) + "|";
|
||||
}
|
||||
}
|
||||
|
||||
prefixes = prefixes.substring(0, prefixes.length() - 1);
|
||||
suffixes = suffixes.substring(0, suffixes.length() - 1);
|
||||
|
||||
|
||||
System.out.println(prefixes + ")" + regex + suffixes + ")");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user