Struts - validating foreign characters

M

mdjj

I need to validate my web app to allow both english and european
characters (anything else I'll reject). I can do it by allowing
individual characters in the mask i.e.
From validation.xml :

<constant>
<constant-name>alphaForeignCheck</constant-name>
<constant-value>^[a-zA-Z è\s]*$</constant-value>
</constant>

This will allow for alphas and è. But rather than list individual
foreign characters is there a way to group say all french all german
characters?
 
O

Oliver Wong

mdjj said:
I need to validate my web app to allow both english and european
characters (anything else I'll reject). I can do it by allowing
individual characters in the mask i.e.
From validation.xml :

<constant>
<constant-name>alphaForeignCheck</constant-name>
<constant-value>^[a-zA-Z è\s]*$</constant-value>
</constant>

This will allow for alphas and è. But rather than list individual
foreign characters is there a way to group say all french all german
characters?

Unicode code charts are at: http://www.unicode.org/charts/

You'll probably want \u00c0 to \u00FF, except not \u00f7 and \u00d7. You
might want to also look at Latin Extended A and Latin Extended B.

Perhaps you can save yourself a lot of effort and do the validation in Java,
via Character.isLetter()

- Oliver
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top