bugGNU Octave - Bugs: bug #47403, 'strsplit' function doesn't work...

 
 

bug #47403: 'strsplit' function doesn't work with delimiter '+'

Submitted by:  Luis Mendo <lmendo>
Submitted on:  Mon 14 Mar 2016 01:29:33 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: Lachlan Andrew <lachlan>
Originator Name: Luis MendoOpen/Closed: Closed
Release: 4.0.0Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Wed 16 Mar 2016 04:19:05 AM UTC, comment #5:

I checked ostrsplit and it produces the same results as when CollapseDelimiters is false. When run with that option set the other way it swallows the last term, which is different than strsplit.

I modified the patch because the '+' character is inside of a character class expression and doesn't need backslash escaping. The cset is here http://hg.savannah.gnu.org/hgweb/octave/rev/04e0598f8b94.

Marking as fixed and cloing report.

Rik <rik5>
Project Administrator
Tue 15 Mar 2016 07:42:37 PM UTC, comment #4:

Can you please also check + if needed patch ostrsplit.m ?

Philip Nienhuis <philipnienhuis>
Project Member
Tue 15 Mar 2016 08:05:17 AM UTC, comment #3:

The attached changeset has a test for '+'.

I also did a test of all ASCII delimiters (32-127), which passes. Should I put that in the automated tests?

(file #36642)

Lachlan Andrew <lachlan>
Project MemberIn charge of this item.
Mon 14 Mar 2016 11:39:42 PM UTC, comment #2:

Can one of you add a test case to strsplit.m for this bug?

Mike Miller <mtmiller>
Project Administrator
Mon 14 Mar 2016 11:19:05 AM UTC, comment #1:

Thanks, Luis.

I'm attaching a changeset based on your file.

(file #36631)

Lachlan Andrew <lachlan>
Project MemberIn charge of this item.
Mon 14 Mar 2016 01:29:33 AM UTC, original submission:

The following produces an error

instead of the correct result, which is

The problem seems to be that line 199 of 'strsplit.m'

doesn't escape '+' (it does escape other characters).

The solution is simply to add '\+' (escaped) to the regexp in that line, so that '+' also gets escaped:

I attach the modified file. It seems to work correctly, also with the 'CollapseDelimiters' option:

Luis Mendo <lmendo>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #36631:  bug_47403_strsplit.cset added by lachlan (876B - text/x-diff)
file #36627:  strsplit_modified.m added by lmendo (11KiB - application/octet-stream)

 

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 lachlan (Updated the item)
  • -unavailable- added by lmendo (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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 16 Mar 2016 04:19:05 AM UTCrik5StatusPatch Submitted=>Fixed
      Open/ClosedOpen=>Closed
    Tue 15 Mar 2016 08:05:17 AM UTClachlanAttached File-=>Added bug_47403_strsplit.v1.cset, #36642
    Mon 14 Mar 2016 11:19:05 AM UTClachlanAttached File-=>Added bug_47403_strsplit.cset, #36631
      StatusNone=>Patch Submitted
      Assigned toNone=>lachlan
    Mon 14 Mar 2016 01:29:33 AM UTClmendoAttached File-=>Added strsplit_modified.m, #36627

    Back to the top


    Powered by Savane 3.1-cleanup1