1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    208
    Vote Rating
    0
    Answers
    2
    bee is on a distinguished road

      0  

    Default Answered: Regular expression for Alt Gr

    Answered: Regular expression for Alt Gr


    Hi I want to add áéíóú characters in my textfield along with albhabets and spaces
    maskRe : /([a-zA-Z\s]+)$/, for my textfield please let me know which regex to be used for these spacila characters as well ?

  2. Code:
    /[a-zA-Z\s\u00E1\u00E9\u00ED\u00F3\u00FA]/

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,625
    Vote Rating
    331
    Answers
    550
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    maskRe is run against a single character, as it is typed. Your existing regex is quite a bit more complicated than it needs to be, the (), + and $ are all unnecessary.

    For the accented characters, have you tried just adding those characters to your character class (the thing surrounded with square brackets)? If that doesn't work, try escaping them in the form \uXXXX to avoid any character encoding problems.

  4. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    208
    Vote Rating
    0
    Answers
    2
    bee is on a distinguished road

      0  

    Default


    Quote Originally Posted by skirtle View Post
    maskRe is run against a single character, as it is typed. Your existing regex is quite a bit more complicated than it needs to be, the (), + and $ are all unnecessary.

    For the accented characters, have you tried just adding those characters to your character class (the thing surrounded with square brackets)? If that doesn't work, try escaping them in the form \uXXXX to avoid any character encoding problems.
    You meant to say should I mention this way ?
    /[áéíóúa-zA-Z\s]/

  5. #4
    Sencha User
    Join Date
    Mar 2011
    Posts
    208
    Vote Rating
    0
    Answers
    2
    bee is on a distinguished road

      0  

    Default


    I tried above which I showed last post but didnt work.
    how to use \uXXXX

  6. #5
    Sencha User
    Join Date
    Mar 2011
    Posts
    208
    Vote Rating
    0
    Answers
    2
    bee is on a distinguished road

      0  

    Default


    I used this way /([a-zA-Z\s]+)$\uXXXX/,

    but didnt work..!!

  7. #6
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,625
    Vote Rating
    331
    Answers
    550
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Code:
    /[a-zA-Z\s\u00E1\u00E9\u00ED\u00F3\u00FA]/

  8. #7
    Sencha User
    Join Date
    Mar 2011
    Posts
    208
    Vote Rating
    0
    Answers
    2
    bee is on a distinguished road

      0  

    Default


    Thx Kirtle it works fine

Thread Participants: 1