octave-maintainers
[Top][All Lists]
Advanced

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

Re: behavior of regexp ( ) function


From: Daniel J Sebald
Subject: Re: behavior of regexp ( ) function
Date: Sun, 01 Feb 2009 00:20:51 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020

HALL, BENJAMIN PW wrote:
|-----Original Message----- |From: David Bateman [mailto:address@hidden |Sent: Wednesday, January 28, 2009 3:21 PM
|
| ** snip **
|
|I no longer have easy to matlab so can someone run the commands
|
|a = sprintf('20\t50\tcelcius\t80');
|b = sprintf('20\t50\t\t80');
|regexp(a, '[^\t]+', 'match')
|regexp(b, '[^\t]+', 'match')
|regexp(a, '[^\t]*', 'match')
|regexp(b, '[^\t]*', 'match')
|
|on matlab and send the results? Its not clear from your |message John if |the behavior described by Daniel is the right one.
|
|Thanks
|D.
|


ans =
    '20'    '50'    'celcius'    '80'


ans =
    '20'    '50'    '80'


ans =
    '20'    '50'    'celcius'    '80'


ans =
    '20'    '50'    '80'


Odd, what exactly is the difference between the '+' and '*' qualifiers then?  
It's too bad there isn't a form that puts an empty string for the zero length 
match.  That would be perfect for reading tab or comma separated files.

I'll give the patch a try sometime middle of next week.  Thanks David.

Dan


reply via email to

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