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

preprocessor.PlusOperatorExpansion 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.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