You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Simon Matic Langford <si...@pcmsgroup.com> on 2004/11/24 17:45:58 UTC
Getting a regular expression from application.properties
I have a regular expression for date formatting (don't ask!) in our
application.properties. This can
change depending on user locale. I am trying to get the following value
back:
^[0-9]'{'0,10'}'(,[0-9]'{'0,2'}')?$
However in MessageResources at line 346: format = new
MessageFormat(escape(formatString));
escape replaces ' with '', which means that my {'s and }'s don't get
escaped properly
and MessageFormat throws an IllegalArgumentException saying it can't
parse the expression.
Is there any way to persuade Struts not to do this escaping without
totally bypassing
it?
I am using Struts 1.1 and cannot upgrade...
Thanks
Simon
The information contained in this e-mail is intended only for the person
or
entity to which it is addressed and may contain confidential and/or
privileged material. If You are not the intended recipient of this
e-mail,
the use of this information or any disclosure, copying or distribution
is
Prohibited and may be unlawful. If you received this in error, please
contact the sender and delete the material from any computer. The views
expressed in this e-mail may not necessarily be the views of The PCMS
Group
plc and should not be taken as authority to carry out any instruction
contained.
RE: Getting a regular expression from application.properties
Posted by Simon Matic Langford <si...@pcmsgroup.com>.
yes, then the app gets:
^[0-9]\''{\''0,10\''}\''(,[0-9]\''{\''0,2\''}\'')?$
all the escaping does is replace ' with '', which makes it a little hard
to stop
it as the comparison is done on a character by character basis...
> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Bill Siggelkow
> Sent: 24 November 2004 17:59
> To: user@struts.apache.org
> Subject: Re: Getting a regular expression from application.properties
>
>
>
> Did you try escaping the single qoutes with a backslash?
>
> ^[0-9]\'{\'0,10\'}\'(,[0-9]\'{\'0,2\'}\')?$
>
>
> Simon Matic Langford wrote:
>
> > I have a regular expression for date formatting (don't ask!) in our
> > application.properties. This can
> > change depending on user locale. I am trying to get the
> following value
> > back:
> >
> > ^[0-9]'{'0,10'}'(,[0-9]'{'0,2'}')?$
> >
> > However in MessageResources at line 346: format = new
> > MessageFormat(escape(formatString));
> >
> > escape replaces ' with '', which means that my {'s and }'s don't get
> > escaped properly
> > and MessageFormat throws an IllegalArgumentException saying it can't
> > parse the expression.
> >
> > Is there any way to persuade Struts not to do this escaping without
> > totally bypassing
> > it?
> >
> > I am using Struts 1.1 and cannot upgrade...
> >
> > Thanks
> >
> > Simon
> >
> >
> >
> > The information contained in this e-mail is intended only
> for the person
> > or
> > entity to which it is addressed and may contain confidential and/or
> > privileged material. If You are not the intended recipient of this
> > e-mail,
> > the use of this information or any disclosure, copying or
> distribution
> > is
> > Prohibited and may be unlawful. If you received this in
> error, please
> > contact the sender and delete the material from any
> computer. The views
> > expressed in this e-mail may not necessarily be the views
> of The PCMS
> > Group
> > plc and should not be taken as authority to carry out any
> instruction
> > contained.
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Getting a regular expression from application.properties
Posted by Bill Siggelkow <bi...@bellsouth.net>.
Did you try escaping the single qoutes with a backslash?
^[0-9]\'{\'0,10\'}\'(,[0-9]\'{\'0,2\'}\')?$
Simon Matic Langford wrote:
> I have a regular expression for date formatting (don't ask!) in our
> application.properties. This can
> change depending on user locale. I am trying to get the following value
> back:
>
> ^[0-9]'{'0,10'}'(,[0-9]'{'0,2'}')?$
>
> However in MessageResources at line 346: format = new
> MessageFormat(escape(formatString));
>
> escape replaces ' with '', which means that my {'s and }'s don't get
> escaped properly
> and MessageFormat throws an IllegalArgumentException saying it can't
> parse the expression.
>
> Is there any way to persuade Struts not to do this escaping without
> totally bypassing
> it?
>
> I am using Struts 1.1 and cannot upgrade...
>
> Thanks
>
> Simon
>
>
>
> The information contained in this e-mail is intended only for the person
> or
> entity to which it is addressed and may contain confidential and/or
> privileged material. If You are not the intended recipient of this
> e-mail,
> the use of this information or any disclosure, copying or distribution
> is
> Prohibited and may be unlawful. If you received this in error, please
> contact the sender and delete the material from any computer. The views
> expressed in this e-mail may not necessarily be the views of The PCMS
> Group
> plc and should not be taken as authority to carry out any instruction
> contained.
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org