behavior of regexp ( ) function

Daniel J Sebald daniel.sebald at ieee.org
Sun Feb 1 00:20:51 CST 2009


HALL, BENJAMIN PW wrote:
>  
> |-----Original Message-----
> |From: David Bateman [mailto:dbateman at dbateman.org] 
> |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


More information about the Octave-maintainers mailing list