bugGNU Octave - Bugs: bug #48377, regex cannot process nested token...

 
 

bug #48377: regex cannot process nested token groups

Submitter:  Lachlan Andrew <lachlan>
Submitted:  Sat 02 Jul 2016 12:17:26 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 02 Jul 2016 12:42:39 PM UTC, comment #1: 

Oops.  I just didn't know how to use regular expressions.

The pattern was cut off, but was originally (...(...))+ and the "correct" behaviour of that regex is to return only the last match of the pattern.

Lachlan Andrew <lachlan>
Sat 02 Jul 2016 12:17:26 PM UTC, original submission:  

I would expect


[S, E, TE, M, T, NM, SP] = regexp ("  abc  def", "(\\s+(\\S+))+");


to give four values in T: "  abc", "abc", "  def", "def".  However, it only gives two: "  def", "def":


T =
{
  [1,1] =
  {
    [1,1] =   def
    [1,2] = def
  }
}


I haven't checked whether Matlab handles nested groups, but if this pattern isn't handled correctly, it should report an error, rather than giving the wrong result.

Lachlan Andrew <lachlan>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lachlan (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-07-02 lachlan StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code