'/(\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 <[EMAIL PROTECTED]>
> 
> 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 ([EMAIL PROTECTED] rxcut ]) s
> ++-----+-+----+-+---+
> ||Henry| |Rich| |xxx|
> ++-----+-+----+-+---+
>     4 0 3 2 5 6 ;@:{ p (','; [EMAIL PROTECTED] rxcut ]) s
> Rich, Henry xxx



      
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to