PDA

View Full Version : Support of regex in ExtGWT



MickeyMiner
25 Nov 2009, 7:11 AM
Hi,

Does ExtGWT support something like this?


import java.util.regex.Matcher;
import java.util.regex.Pattern;

Pattern p = Pattern.compile("([A-Z]{2}) (.*)");
Matcher m = p.matcher(content);
if (m.matches()) {
System.out.println("group(0): " + m.group(0) + " group(1):" + m.group(1));
}Thanx,

mm

sven
25 Nov 2009, 7:15 AM
The question is not if extgwt supports this, but if GWT supports it.

Pattern cannot be used in GWT at the moment, you will need to write a emulation on your own for htis at the moment.

You can also use JSNI and do it with javascript.

martyhall
25 Nov 2009, 7:30 AM
As Sven said, GWT does not support Pattern. Here is a complete list of supported classes and methods as of GWT 1.7: http://code.google.com/webtoolkit/doc/1.6/RefJreEmulation.html

However, the regular-expression-aware methods in the String class (e.g., split, replaceAll) do support regular expressions. Just be aware that there are slight differences between Java and JavaScript regular expressions, so test carefully.

Cheers-

- Marty
__________________
http://courses.coreservlets.com/public-courses/gwt/
Public GWT Training Courses

MickeyMiner
25 Nov 2009, 2:24 PM
Hi,

Thank you for your answers.
Hopefully Google implements Pattern soon. (perhaps wit JavaScript regex syntax).

Cheers,

mm

campersau1
25 Nov 2009, 2:43 PM
Here is the bug: http://code.google.com/p/google-web-toolkit/issues/detail?id=1727