octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regexp help


From: Ben Abbott
Subject: Re: Regexp help
Date: Fri, 05 Jul 2013 17:17:05 -0400

On Jul 5, 2013, at 4:28 PM, Rik wrote:

> 7/5/13
> 
> Can someone with Matlab access run the following code?
> 
> [TE, T, NM, SP] = regexp ('abc', '(?<name1>\w+)(?<junk> )?(?<name1>\w+)',
> 'tokenExtents', 'tokens', 'names', 'split')
> celldisp (TE)
> celldisp (T)
> 
> I want to know how they handle duplicate named patterns when there is no
> alternation.  I'm hoping they haven't gone overboard and returned a struct
> array for NM.
> 
> --Rik

[TE, T, NM, SP] = regexp ('abc', '(?<name1>\w+)(?<junk> 
)?(?<name1>\w+)','tokenExtents', 'tokens', 'names', 'split')

TE = 

    [3x2 double]


T = 

    {1x3 cell}


NM = 

    name1: 'ab'
     junk: ''


SP = 

    ''    ''

celldisp (TE)
 
TE{1} =
 
     1     2
     3     2
     3     3

 
celldisp (T)
 
T{1}{1} =
 
ab
 
 
T{1}{2} =
 
     ''
 
 
T{1}{3} =
 
c

reply via email to

[Prev in Thread] Current Thread [Next in Thread]