Example usage for com.google.gwt.regexp.shared RegExp getSource

List of usage examples for com.google.gwt.regexp.shared RegExp getSource

Introduction

In this page you can find the example usage for com.google.gwt.regexp.shared RegExp getSource.

Prototype

public final String getSource() 

Source Link

Usage

From source file:org.idwebmail.client.MainEntryPoint.java

private boolean validEmail(String str) {
    RegExp reStandar = RegExp.compile(
            "((([\\\"][\\w\\s]+([\\\"])+?)([<][\\w.]+@[\\w.]+\\.[a-zA-Z]{2,4}[>]))+)|(([\\w.]+@[\\w.]+\\.[a-zA-Z]{2,4})+)");
    String[] parts = str.split(";");
    int i;/*from   www .j a v a 2 s .c o m*/
    for (i = 0; i < parts.length; i++) {
        if (!parts[i].matches(reStandar.getSource()))
            return false;
    }
    return true;
}

From source file:org.opennms.features.topology.app.internal.gwt.client.service.filter.PatternMatchingFilter.java

License:Open Source License

public static String toFilterMatch(RegExp regex) {
    String value = regex.getSource();

    value = value.replace("\\*", "~~ESCAPED_STAR~~");

    value = value.replace(".*", "*");

    value = value.replaceAll("\\\\(.)", "$1");

    value = escapeAll(value, "\\");

    value = escapeAll(value, "()");

    value = value.replace("~~ESCAPED_STAR~~", "\\*");

    return value;
}