
preprocessor.QuestionMarkOperatorExpansion 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 preprocessor;
import preprocessor.ParsingPreprocessor.RegexOperator.OperatorType;
import preprocessor.ParsingPreprocessor.*;
public class QuestionMarkOperatorExpansion extends OperatorExpansionRule {
@Override
protected void expandOperator(StringBuilder resultBuilder, RegexToken factor, RegexToken operator) {
resultBuilder.append("(" + "\\l|" + factor.getRepresentation() + ")");
}
@Override
protected RegexOperator getOperator() {
return new QuantifiableOperator("?", OperatorType.QM);
}
@Override
protected OperatorType getOperatorType() {
return OperatorType.QM;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy