octave-maintainers
[Top][All Lists]
Advanced

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

Re: behavior of regexp ( ) function


From: David Bateman
Subject: Re: behavior of regexp ( ) function
Date: Wed, 28 Jan 2009 21:20:30 +0100
User-agent: Mozilla-Thunderbird 2.0.0.17 (X11/20081018)

John W. Eaton wrote:
I'm not sure whether this is a bug.  But it is apparently incompatible
behavior.  I don't know what the fix is, but I looked at the
octregexp_list function, and it is correctly matching the first "20"
and moving idx forward to 2 (the position of the next character in the
string).  But then the next call to pcre_exec is matching zero or more
of anything not TAB and returning a zero-length substring starting and
ending at idx == 2.  So then ovector[1] <= ovector[0] and execution
breaks out of the loop.

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.




David, would you say this is a bug in Octave, or Matlab?  How would
you interpret the '[^\t]*' regexp in this case?  If it is a bug in
Octave, do you see a fix?

Thanks,

jwe



--
David Bateman                                address@hidden
35 rue Gambetta                              +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)



reply via email to

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