[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #38149] regexp doesn't return empty tokens --
From: |
Michael Godfrey |
Subject: |
[Octave-bug-tracker] [bug #38149] regexp doesn't return empty tokens -- they just disappear |
Date: |
Fri, 01 Feb 2013 18:04:40 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 |
Follow-up Comment #14, bug #38149 (project octave):
Better, I'd say:
>> te = regexp ('abc', 'abc(z?)', 'tokenExtents');
>> celldisp (te)
te{1} =
4 3
>>
>> te = regexp ('abce', '((a)(z)?b(c)(z*))(z)?(e)?', 'tokenExtents');
>> celldisp (te)
te{1} =
1 3
4 3
4 4
>>
>> [T, TE, NM] = regexp (sprintf('%s','John DavisnRogers, James'),
'(?<first>w+)s+(?<last>w+)|(?<last>w+),s+(?<first>w+)', 'tokens',
'tokenExtents', 'names');
>>
>> celldisp (T)
T{1}{1} =
John
T{1}{2} =
Davis
T{2}{1} =
nRogers
T{2}{2} =
James
>> celldisp (TE)
TE{1} =
1 4
6 10
TE{2} =
12 18
21 25
>> NM(1).first
ans =
John
>> NM(1).last
ans =
Davis
>> NM(2).first
ans =
James
>> NM(2).last
ans =
nRogers
>>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?38149>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #38149] regexp doesn't return empty tokens -- they just disappear, Michael Godfrey, 2013/02/01
- [Octave-bug-tracker] [bug #38149] regexp doesn't return empty tokens -- they just disappear, Rik, 2013/02/01
- [Octave-bug-tracker] [bug #38149] regexp doesn't return empty tokens -- they just disappear, Michael Godfrey, 2013/02/01
- [Octave-bug-tracker] [bug #38149] regexp doesn't return empty tokens -- they just disappear, Rik, 2013/02/01
- [Octave-bug-tracker] [bug #38149] regexp doesn't return empty tokens -- they just disappear, Michael Godfrey, 2013/02/01
- [Octave-bug-tracker] [bug #38149] regexp doesn't return empty tokens -- they just disappear, Rik, 2013/02/01
- [Octave-bug-tracker] [bug #38149] regexp doesn't return empty tokens -- they just disappear, Michael Godfrey, 2013/02/01
- [Octave-bug-tracker] [bug #38149] regexp doesn't return empty tokens -- they just disappear, Rik, 2013/02/01
- [Octave-bug-tracker] [bug #38149] regexp doesn't return empty tokens -- they just disappear,
Michael Godfrey <=