velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nbu...@gmail.com>
Subject Re: regex in template
Date Sat, 17 Jan 2009 16:25:32 GMT
On Tue, Jan 13, 2009 at 3:37 PM, Jason Berk <jberk@purdueefcu.com> wrote:
> Velocity rocks, but I do have a few questions:
>
> 1. when/where is the javadoc for the 1.6 engine?

http://velocity.apache.org/engine/releases/velocity-1.6/apidocs/index.html

> 2. is it possible to do a regex in a template?

If you are running on a JDK that supports it (1.5+), yes.

>
> Something like this:
>
> #set( $regex = "foo" )

I would do #set( $regex = 'foo' )  just to ensure Velocity doesn't
interpolate your regex.

> #foreach( $item in $itemList )
> #if( $item.getItemId().startsWith($regex) )

Assuming that getItemId() returns a String, you will need to use the
matches(String regex) method.  startsWith() doesn't expect a regex.

> ...do something...
> #end
> #end
>
> Make sense?
>
> Thanks,
>
> Jason
>
>
> The PEN is now mightier than the PIN. Simply use your PEN
> instead of your PIN and sign for your PEFCU Visa Check Card
> purchases. Earn bonus points redeemable for gift and travel
> awards. Combine PEFCU Visa check card and credit card points
> for even more rewards.
>
>
> ***This is a transmission from Purdue Employees Federal Credit
> Union (PEFCU) and is intended solely for its authorized
> recipient(s), and may contain information that is confidential
> and or legally privileged.  If you are not an addressee, or the
> employee or agent responsible for delivering it to an addressee,
> you are hereby notified that any use, dissemination,
> distribution, publication or copying of the information
> contained
> in this email is strictly prohibited. If you have received this
> transmission in error, please notify us by telephoning (765)
> 497-3328 or returning the email. You are then instructed to
> delete the information from your computer.  Thank you for your
> cooperation.***
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

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


Mime
View raw message