You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Colin Freas <co...@gmail.com> on 2010/12/23 16:58:11 UTC

regex in if tag?

I'm trying to use a regex in the test of an if tag.  The object in the test
is a String, so I'm trying this, and it isn't working:
<s:if test="%{workNodeName}.matches(\".+\")">

Is this possible?  Is there another way to do this?

Re: regex in if tag?

Posted by Colin Freas <cf...@gmail.com>.
Thanks, gents.  Perfect!

On Thu, Dec 23, 2010 at 2:13 PM, Dave Newton <da...@gmail.com> wrote:

> Yep, the entire expression needs to be in the OGNL escape.
>
> Although I'd just use single and double quotes to avoid the escapes.
>
> Dave
>
> On Thu, Dec 23, 2010 at 12:53 PM, Maurizio Cucchiara <
> maurizio.cucchiara@gmail.com> wrote:
>
> > Try this:
> > <s:if test="workNodeName.matches(\".+\")">
> >
> > 2010/12/23 Colin Freas <co...@gmail.com>:
> > > I'm trying to use a regex in the test of an if tag.  The object in the
> > test
> > > is a String, so I'm trying this, and it isn't working:
> > > <s:if test="%{workNodeName}.matches(\".+\")">
> > >
> > > Is this possible?  Is there another way to do this?
> > >
> >
> >
> >
> > --
> > Maurizio Cucchiara
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>

Re: regex in if tag?

Posted by Dave Newton <da...@gmail.com>.
Yep, the entire expression needs to be in the OGNL escape.

Although I'd just use single and double quotes to avoid the escapes.

Dave

On Thu, Dec 23, 2010 at 12:53 PM, Maurizio Cucchiara <
maurizio.cucchiara@gmail.com> wrote:

> Try this:
> <s:if test="workNodeName.matches(\".+\")">
>
> 2010/12/23 Colin Freas <co...@gmail.com>:
> > I'm trying to use a regex in the test of an if tag.  The object in the
> test
> > is a String, so I'm trying this, and it isn't working:
> > <s:if test="%{workNodeName}.matches(\".+\")">
> >
> > Is this possible?  Is there another way to do this?
> >
>
>
>
> --
> Maurizio Cucchiara
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: regex in if tag?

Posted by Maurizio Cucchiara <ma...@gmail.com>.
Try this:
<s:if test="workNodeName.matches(\".+\")">

2010/12/23 Colin Freas <co...@gmail.com>:
> I'm trying to use a regex in the test of an if tag.  The object in the test
> is a String, so I'm trying this, and it isn't working:
> <s:if test="%{workNodeName}.matches(\".+\")">
>
> Is this possible?  Is there another way to do this?
>



-- 
Maurizio Cucchiara

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org