[Jprogramming] Swap first/last names
Henry Rich
HenryHRich at nc.rr.com
Thu Aug 21 07:50:33 HKT 2008
THAT's what I was looking for. I fixed the x. and
y. and it worked great.
Henry Rich
> -----Original Message-----
> From: programming-bounces at jsoftware.com
> [mailto:programming-bounces at jsoftware.com] On Behalf Of Oleg Kobchenko
> Sent: Wednesday, August 20, 2008 6:54 PM
> To: Programming forum
> Subject: Re: [Jprogramming] Swap first/last names
>
> '/(\w+) (\w+) (.*)/\2, \1 \3' rxs 'Henry Rich xxx'
> Rich, Henry xxx
>
> See regexs2 from http://olegykj.sourceforge.net/
> from close to 10 years ago.
>
> > From: Raul Miller <rauldmiller at gmail.com>
> >
> > On Wed, Aug 20, 2008 at 3:44 PM, Henry Rich wrote:
> > > I need the regex command that will change
> > > Henry Rich xxx
> > > to
> > > Rich, Henry xxx
> > > (each name is terminated by a single space)
> >
> > require'regex'
> > s=: 'Henry Rich xxx'
> > p=: '(\w+) (\w+) (\w+)'
> > p rxmatch s
> > 0 14
> > 0 5
> > 6 4
> > 11 3
> > p (}. at rxmatch rxcut ]) s
> > ++-----+-+----+-+---+
> > ||Henry| |Rich| |xxx|
> > ++-----+-+----+-+---+
> > 4 0 3 2 5 6 ;@:{ p (','; }. at rxmatch rxcut ]) s
> > Rich, Henry xxx
>
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see
> http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list