Unicode characters in RegExp

Discussion in 'Javascript' started by Ron Brennan, Nov 21, 2004.

  1. Ron Brennan

    Ron Brennan Guest

    I'm trying to test a character for not being uppercase, including Unicode
    Latin-1.

    The following JavaScript expression doesn't work. It is embedded in a
    servlet that targets IE 5 or later.

    if (/[^A-Z \u00C0-\u00D6 \u00D8-\u00DF]/.test(stest))

    Probably something obvious to those of you working with RegExp more than me.

    Thanks,
    Ron
    Ron Brennan, Nov 21, 2004
    #1
    1. Advertising

  2. Ron Brennan

    Evertjan. Guest

    Ron Brennan wrote on 21 nov 2004 in comp.lang.javascript:

    > I'm trying to test a character for not being uppercase, including
    > Unicode Latin-1.
    >
    > The following JavaScript expression doesn't work. It is embedded in a
    > servlet that targets IE 5 or later.
    >
    > if (/[^A-Z \u00C0-\u00D6 \u00D8-\u00DF]/.test(stest))
    >
    > Probably something obvious to those of you working with RegExp more
    > than me.


    Works fine here [btw, leave the spaces out]

    stest='é'
    alert(/[^A-Z\u00C0-\u00D6\u00D8-\u00DF]/.test(stest))

    stest='É'
    alert(/[^A-Z\u00C0-\u00D6\u00D8-\u00DF]/.test(stest))

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress,
    but let us keep the discussions in the newsgroup)
    Evertjan., Nov 21, 2004
    #2
    1. Advertising

  3. Ron Brennan

    Ron Brennan Guest

    > Works fine here [btw, leave the spaces out]
    >
    > stest='é'
    > alert(/[^A-Z\u00C0-\u00D6\u00D8-\u00DF]/.test(stest))
    >
    > stest='É'
    > alert(/[^A-Z\u00C0-\u00D6\u00D8-\u00DF]/.test(stest))
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress,
    > but let us keep the discussions in the newsgroup)


    Works fine here too, once I commented out the part of the program that was
    causing the problem. :)

    Thanks again Evertjan,
    Ron
    Ron Brennan, Nov 21, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Laszlo Nagy
    Replies:
    6
    Views:
    600
  2. Terry Reedy
    Replies:
    0
    Views:
    498
    Terry Reedy
    Jul 1, 2008
  3. M.-A. Lemburg
    Replies:
    0
    Views:
    880
    M.-A. Lemburg
    Jul 2, 2008
  4. Grzegorz ¦liwiñski
    Replies:
    2
    Views:
    939
    Grzegorz ¦liwiñski
    Jan 19, 2011
  5. Joao Silva
    Replies:
    16
    Views:
    342
    7stud --
    Aug 21, 2009
Loading...

Share This Page