Unicode characters in RegExp

R

Ron Brennan

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
 
E

Evertjan.

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))
 
R

Ron Brennan

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top