Hi all, I've read that there are differences between the Java and
Javascript regex patterns, so you'll get different behaviour when it
dev/hosted/prod mode using regex.
I'm trying to do a split which includes the delimiter to process camel
case text. In simpler form (forgetting acronyms and such):
String regex = "(?=[A-Z])";
String[] words = camelCase.split(regex);
// go on to capitalise each word
This works in dev mode - straightforward java regex. But this doesn't
work as expected in prod mode. Then through a little trial and error
here: http://www.pagecolumn.com/tool/regtest.htm (click the "Return"
tab to see the evaluated output)
This piece of javascript did what I wanted.
var myArray = str.split(/(?=[A-Z])/g)
So off I went and plucked "/(?=[A-Z]/g" into my
camelCase.split(regex), but it appears to be just returning the entire
string.
Test browser is FF12.
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment