0

i am using GXT 2.1.1 and GWT 2.0.3. i created a Unicode regex expression, and then set it via TextBundle().setRegEx() function. it works like a charm in debug mode, but not in production.

my goal is to only allow either alphanumeric values, or numeric values only that can also be negative. when i use ASCII expression such as:

^(([a-zA-Z0-9]+)|(\-?[0-9]+))$

it works in both debug and production modes. but when switching to Unicode expression:

^(([\pL\pN]+)|(\-?[\pN]+))$

it only works in debug.

i am really stuck and would greatly appreciate any help. thank you!!!

user1056027
  • 145
  • 2
  • 2
  • 13

1 Answers1

2

Seems to me that JavaScript does not support Unicode shortcut/character-classes natively (see here and here).

Just stick with the first version or use valid character classes.

Community
  • 1
  • 1
Andrea Boscolo
  • 3,038
  • 1
  • 16
  • 21
  • while i do appreciate your response, are you telling me that there is no Unicode regex support for GXT and/or javascript? – user1056027 Apr 11 '14 at 10:21
  • Yes: no native support in js. GWT is no different since the implementation of the `RegExp` class (starting from GWT 2.1) is based on the `RegExp` js object (which is different from the Java one: check the doc I linked). Before GWT 2.1, there is only JSNI. Can't say for GXT but I hardly think so (and your issue is a clear clue). – Andrea Boscolo Apr 11 '14 at 13:56