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