bugGNU Octave - Bugs: bug #43649, strfind returns matches for empty...

 
 

bug #43649: strfind returns matches for empty pattern

Submitted by:  Andreas Weber <andy1978>
Submitted on:  Thu 20 Nov 2014 04:23:22 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.8.2Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 06 Dec 2014 06:19:04 AM UTC, comment #4:

I changed strfind to be Matlab compatible in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/f054112912df). Closing report.

Rik <rik5>
Project Administrator
Thu 20 Nov 2014 11:16:10 PM UTC, comment #3:

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.

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.

Rik <rik5>
Project Administrator
Thu 20 Nov 2014 05:50:56 PM UTC, comment #2:

It's explicitly noted in the "More About" section of

http://www.mathworks.com/help/matlab/ref/strfind.html

that a pattern of an empty string results in nothing being found. Might be worth specifically noting this case in our docstring also to avoid confusion.

Mike Miller <mtmiller>
Project Administrator
Thu 20 Nov 2014 05:43:34 PM UTC, comment #1:

I guess we will still need to fix this for Matlab compatibility though.

Carnë Draug <carandraug>
Project Member
Thu 20 Nov 2014 04:23:22 PM UTC, original submission:

Octave 3.8.2 and default returns

whereas MATLAB R2014a returns empty

which is more intuitive for me.

Andreas Weber <andy1978>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by andy1978 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 06 Dec 2014 06:19:04 AM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Thu 20 Nov 2014 05:50:56 PM UTCmtmillerCategoryNone=>Octave Function
      StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1