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

org.whitesource.agent.hash.RegexUtils Maven / Gradle / Ivy

There is a newer version: 18.4.1
Show newest version
package org.whitesource.agent.hash;

import org.apache.commons.lang.StringUtils;

/**
 * Utility class for regular expressions related functionality.
 *
 * @author Edo.Shor
 */
public final class RegexUtils {

	/* --- Public methods --- */

    public static String toJava(String regex) {
        if (StringUtils.isBlank(regex)) {
            return regex;
        } else {
            return regex.replaceAll("\\.", "\\\\.")
                    .replaceAll("\\*",".*");
        }
    }

	/* --- Constructors --- */

    /**
     * Private default constructor
     */
    private RegexUtils() {
        // avoid instantiation
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy