
matcher.driver.MatcherDriver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of regex-static-analysis Show documentation
Show all versions of regex-static-analysis Show documentation
A tool to perform static analysis on regexes to determine whether they are vulnerable to ReDoS.
package matcher.driver;
import matcher.*;
import regexcompiler.*;
import analysis.AnalysisSettings.NFAConstruction;
public class MatcherDriver {
public static void main(String args[]) {
if (args.length < 2) {
System.out.println("usage: java MatcherDriver ");
System.exit(0);
}
String pattern = args[0];
String inputString = args[1];
MyPattern myPattern = MyPattern.compile(pattern, NFAConstruction.JAVA);
MyMatcher myMatcher = myPattern.matcher(inputString);
boolean matches = myMatcher.matches();
System.out.println(pattern + " matches " + inputString + ": " + matches);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy