Struts validation using regular experssions

S

stephenfu1

Hi,

I wish to use the struts validator framework but i'm having trouble
with the regular expression

I want the field to be:

-Only allowed characters are alpha, apostrophe, full stop, hypen or
space
-First character to be A-Z
-Last character not to be punctuation
-Consecutive punctuation are not allowed
-Consecutive spaces are not allowed

I've been trying to build from [A-Z]([A-Za-z]|['-. ?])[A-Za-z]$

That doesn't work because its enforcing the string to be 3 characters.
If i start trying to use * then i run into problems of encforcing no
consecutive punctuation / spaces

Anyone any ideas? Any help would be appreciated.

Thanks
 

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
474,001
Messages
2,570,254
Members
46,850
Latest member
VMRKlaus8

Latest Threads

Top