Hybrid View

  1. #1
    Ext GWT Premium Member
    Join Date
    Feb 2011
    Posts
    15
    Vote Rating
    0
    werum2011 is on a distinguished road

      0  

    Question Answered: Invalid regular expression - I dont get it

    Answered: Invalid regular expression - I dont get it


    Hello,

    I have a problem using regular expressions for validating text fields in gxt (2.2.5).

    Using this code:
    Code:
          
    this.dialog.getMyTextField().setRegex( "[0-9]{1,3}\\°( )?+[0-9]{1,2}(\\,[0-9]{1,6})?\\'" );
    this.dialog.getMyTextField().getMessages().setRegexText( "<GG° MM,mmmmmm'>" );
    this.dialog.getMyTextField().setAutoValidate( true );
    I get following exception:
    SyntaxError: Invalid regular expression: /[0-9]{1,3}\°( )?+[0-9]{1,2}(\,[0-9]{1,6})?\'/: Nothing to repeat

    But in plain Java-Regex it works fine.
    Any ideas, whats wrong with my expression? What do I have to change to make it work in GXT/JavaScript?

    Thanks in advance,


  2. #2
    Sencha User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    867
    Answers
    9
    Vote Rating
    1
    micgala is on a distinguished road

      0  

    Default


    Yes. You will need a valid javascript regex.

  3. #3
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Answers
    60
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

Thread Participants: 2