GWT Parsing efficient

This example introduces RegExp class that provides cross-browser parsing capability. By default, GWT do not support advanced regular expression on every browser.

For instance: The regular expression do not have the same meaning if you are using Firefox 3.5 or Internet Explorer 8.

To solve this, GWT developer have added com.google.gwt.regexp.shared.RegExp to the 2.0+ version.

Source

import com.google.gwt.regexp.shared.RegExp;
import com.google.gwt.regexp.shared.SplitResult;
 
/***
 * Process Corner Helper
 * 
 * Convert a set of PVTs separated by \n and ( or \)
 * ss_typical_min_0p99v_1p011v_m40c \\\n" +
 * tt_typical_max_0p90v_25c \\\n" +
 * "ff_typical_min_0p99v_1p0v_m40c";
 *	
 * Note:
 *  This source code is based on RegExp class that appears in GWT 2.1
 *  This class provides cross browser parsing based on JNSI implementation. 
 *  The regular expression is little bit unusual.
 *  
 *  eg:
 *  	\n <> \\n
 *  	\s <> \\s
 *  	\\ <> \\\\
 *  
 *  I find clear explanation in this message :
 *  http://stackoverflow.com/questions/4158201/gwt-how-to-get-regexpattern-and-matcher-working-in-client-side
 *  
 *  Documentation
 *	http://google-web-toolkit.googlecode.com/svn/javadoc/2.2/com/google/gwt/regexp/shared/package-summary.html
 *
 * TODO Not a widget : Class should be move in another package
 * 			
 * @author victor benarbia
 *
 */
public class ProcessCornerHelper {
 
	/***
	 * Convert plain pvts list to array of String
	 * 
	 * @param pvtsString
	 * @return array of String
	 */
	public static String[] split(String pvtsString) {
                // It does not support UNIX style regular expression
		RegExp separatorRegex = RegExp.compile("\\s*[\\\\]*\\s*\\n\\s*");
		SplitResult pvs = separatorRegex.split(pvtsString);
 
		String[] pvts = new String[pvs.length()];
		for (int i = 0; i < pvs.length(); i++) {
			pvts[i] = pvs.get(i).trim();
		}
		return pvts;
	}
 
}

Then, you can write a quick test to run the validation.

Short conclusion

After hours of testing, I can conclude that this piece of code is working on most of the common browser.