bugGNU Octave - Bugs: bug #39424, regexp: nested parentheses returns...

 
 

bug #39424: regexp: nested parentheses returns more tokens than Matlab

Submitter:  Rik <rik5>
Submitted:  Sun 07 Jul 2013 09:52:48 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 21 Nov 2016 10:14:47 PM UTC, comment #1: 

Octave still behaves the same in version 4.2.0.

Hartmut <hardy>
Sun 07 Jul 2013 09:52:48 PM UTC, original submission:  

According to Matlab documentation,


Note:   If an expression has nested parentheses, MATLAB captures tokens that correspond to the outermost set of parentheses. For example, given the search pattern '(and(y|rew))', MATLAB creates a token for 'andrew' but not for 'y' or 'rew'.


Octave, following PCRE, creates a token for every subpattern which matches.


regexp ('andrew', '(and(y|rew))', 'tokens')
ans =
{
  [1,1] =
  {
    [1,1] = andrew
    [1,2] = rew
  }
}


The solution probably means re-writing the pattern before passing it off to PCRE.

Rik <rik5>
Group administrator

 

(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 hardy (Posted a comment)
  • -email is unavailable- added by rik5 (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.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.14-8eb0.
    Corresponding source code