<propertyregex property="userID"
              input="${full.name}"
              regexp="(.)[^\s]*\s([^\s]*)\s"
              select="\1\2"
              casesensitive="false" />

You may have to play around with it to make sure the whitespaces are in the
right places, especially the end of the line. I assumed that a name was on a
single line terminated by whitespace. You are also assuming that a person
can have only two parts to their name. If the last name can have Jr., III,
or something like that following it this reg exp will truncate the name. So,
Fred Flintstone II will be FFlintstone and you will loose that fact that he
has a different name than his father, Fred Flintstone.

HTH Bill
-----Original Message-----
From: Ninju Bohra [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 22, 2005 1:55 PM
To: Ant Users Group
Subject: Need help writing regular expression??

Hello all,

Quick question... I need write a regular expression to generate
<FirstLetterOfFirstName><LastName> from a full name (i.e. <First Name> <Last
Name>)

Given the string:  Ninju Bohra

I want:  NBohra

What is the regular expression (if any) I would use?

<property name="full.name" value="Ninju Bohra"/>

<propertyregex property="userID"
              input="${full.name}"
              regexp="<need help here>"
              select="\1"
              casesensitive="false" />
    
Thanx,

Ninju





                
____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to