You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pierre Thibaudeau <pi...@gmail.com> on 2007/12/07 05:52:13 UTC
Validation "Mask": unicode characters
I am using Struts 1 (more specifically 1.3.8).
I have a form for which I use the Struts Validator.
One of the textual fields should be able to accept any alphabetic character,
as well as spaces and apostrophes.
By "alphabetic characters", I don't merely mean [a-zA-Z], but I am also
interested in:
e acute,
a umlaut,
omega,
aleph,
and (while we're at it) Sanskrit characters.
But I want neither Arabic numerals, nor signs of punctuation (other than the
apostrophe), nor tabs, nor underscores, etc.
I thought this might do it (but it doesn't work):
<field property="name" depends="mask">
<msg name="mask" key="error.nameMask"/>
<var><var-name>mask</var-name><var-value>^[\p{L}\'
]*$</var-value></var>
</field>
The symbol "\p{L}" (which means "any Unicode letter" in Java regex) doesn't
seem to do its job...
Suggestion anyone?
Re: Validation "Mask": unicode characters
Posted by Mohan Radhakrishnan <ra...@gmail.com>.
Since Struts 2 supports J2SE 5.0 all the validation( in-built ) etc. will
inherently use J2SE 5.0's support for i18n. How is this done ?
Thanks,
Mohan
--
View this message in context: http://www.nabble.com/Validation-%22Mask%22%3A-unicode-characters-tp14206855p22841840.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Validation "Mask": unicode characters
Posted by Paul Benedict <pb...@apache.org>.
Let me know. I am really interested in I18N issues. I want to be able to do
the same thing.
On Dec 11, 2007 9:18 AM, Pierre Thibaudeau <pi...@gmail.com>
wrote:
> Thank you, Paul, for the clarification about the parsing of the regex (ORO
> vs JDK 1.4); that's completely new to me! No luck so far in trying to
> checkout the latest build of Validator 1.4, but will try again later
> today.
> Failing that, I'll look into ORO's regex parser.
>
> 2007/12/10, Paul Benedict <pb...@apache.org>:
> >
> > Pierre. I think that Validator 1.3 relies on Jakarta ORO for its regular
> > expression parsing. You need to visit that project and see if it can do
> > what
> > you want.
> >
> > With that said, Validator 1.4 is based on JDK 1.4 and can use the native
> > Java regex engine.
> >
> > Do any of these engines do what you need?
> >
> > Paul
> >
>
Re: Validation "Mask": unicode characters
Posted by Pierre Thibaudeau <pi...@gmail.com>.
Thank you, Paul, for the clarification about the parsing of the regex (ORO
vs JDK 1.4); that's completely new to me! No luck so far in trying to
checkout the latest build of Validator 1.4, but will try again later today.
Failing that, I'll look into ORO's regex parser.
2007/12/10, Paul Benedict <pb...@apache.org>:
>
> Pierre. I think that Validator 1.3 relies on Jakarta ORO for its regular
> expression parsing. You need to visit that project and see if it can do
> what
> you want.
>
> With that said, Validator 1.4 is based on JDK 1.4 and can use the native
> Java regex engine.
>
> Do any of these engines do what you need?
>
> Paul
>
Re: Validation "Mask": unicode characters
Posted by Paul Benedict <pb...@apache.org>.
Pierre. I think that Validator 1.3 relies on Jakarta ORO for its regular
expression parsing. You need to visit that project and see if it can do what
you want.
With that said, Validator 1.4 is based on JDK 1.4 and can use the native
Java regex engine.
Do any of these engines do what you need?
Paul
On Dec 8, 2007 12:45 PM, Pierre Thibaudeau <pi...@gmail.com>
wrote:
> Well, it seems my question got people stumped as much as I am!
>
> For an alternative solution, I would love advice on a (working) regex
> expression that would approximate the class of characters I am aiming at:
> say all the letters of the Latin1 set (ISO-8859-1). If we could
> eventually
> supplement that with Greek, Cyrillic, Arabic and Hebrew alphabets, that
> would probably cover more than all the ground I need.
>
> 2007/12/6, Pierre Thibaudeau <pi...@gmail.com>:
> >
> > I am using Struts 1 (more specifically 1.3.8).
> >
> > I have a form for which I use the Struts Validator.
> >
> > One of the textual fields should be able to accept any alphabetic
> > character, as well as spaces and apostrophes.
> > By "alphabetic characters", I don't merely mean [a-zA-Z], but I am also
> > interested in:
> > e acute,
> > a umlaut,
> > omega,
> > aleph,
> > and (while we're at it) Sanskrit characters.
> > But I want neither Arabic numerals, nor signs of punctuation (other than
> > the apostrophe), nor tabs, nor underscores, etc.
> >
> > I thought this might do it (but it doesn't work):
> >
> > <field property="name" depends="mask">
> > <msg name="mask" key="error.nameMask"/>
> > <var><var-name>mask</var-name><var-value>^[\p{L}\'
> > ]*$</var-value></var>
> > </field>
> >
> > The symbol "\p{L}" (which means "any Unicode letter" in Java regex)
> > doesn't seem to do its job...
> >
> > Suggestion anyone?
> >
>
Re: Validation "Mask": unicode characters
Posted by Pierre Thibaudeau <pi...@gmail.com>.
Well, it seems my question got people stumped as much as I am!
For an alternative solution, I would love advice on a (working) regex
expression that would approximate the class of characters I am aiming at:
say all the letters of the Latin1 set (ISO-8859-1). If we could eventually
supplement that with Greek, Cyrillic, Arabic and Hebrew alphabets, that
would probably cover more than all the ground I need.
2007/12/6, Pierre Thibaudeau <pi...@gmail.com>:
>
> I am using Struts 1 (more specifically 1.3.8).
>
> I have a form for which I use the Struts Validator.
>
> One of the textual fields should be able to accept any alphabetic
> character, as well as spaces and apostrophes.
> By "alphabetic characters", I don't merely mean [a-zA-Z], but I am also
> interested in:
> e acute,
> a umlaut,
> omega,
> aleph,
> and (while we're at it) Sanskrit characters.
> But I want neither Arabic numerals, nor signs of punctuation (other than
> the apostrophe), nor tabs, nor underscores, etc.
>
> I thought this might do it (but it doesn't work):
>
> <field property="name" depends="mask">
> <msg name="mask" key="error.nameMask"/>
> <var><var-name>mask</var-name><var-value>^[\p{L}\'
> ]*$</var-value></var>
> </field>
>
> The symbol "\p{L}" (which means "any Unicode letter" in Java regex)
> doesn't seem to do its job...
>
> Suggestion anyone?
>