octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #43649] strfind returns matches for empty patt


From: Rik
Subject: [Octave-bug-tracker] [bug #43649] strfind returns matches for empty pattern
Date: Thu, 20 Nov 2014 23:16:10 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:33.0) Gecko/20100101 Firefox/33.0

Follow-up Comment #3, bug #43649 (project octave):

So, is the accepted wisdom that we should just change this for Matlab
compatibility, despite the way most other programs handle this?

Incidentally, the regexp function has the option 'emptymatch' to decide which
way to interpret an empty pattern.


octave:1> regexp ('foo', '', 'match')
ans = {}(1x0)
octave:2> regexp ('foo', '', 'match', 'emptymatch')
ans = 
{
  [1,1] = 
  [1,2] = 
  [1,3] = 
  [1,4] = 
}


One way to look at this is that strfind is a Matlab function and they are free
to define how it behaves, while regexp should be more compatible with generic
regular expressions, which it is.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?43649>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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