All Downloads are FREE. Search and download functionalities are using the official Maven repository.

preprocessor.QuestionMarkOperatorExpansion Maven / Gradle / Ivy

Go to download

A tool to perform static analysis on regexes to determine whether they are vulnerable to ReDoS.

There is a newer version: 1.0.8
Show newest version
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