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

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

[Octave-bug-tracker] [bug #39424] regexp: nested parentheses returns mor


From: Rik
Subject: [Octave-bug-tracker] [bug #39424] regexp: nested parentheses returns more tokens than Matlab
Date: Sun, 07 Jul 2013 21:52:49 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0

URL:
  <http://savannah.gnu.org/bugs/?39424>

                 Summary: regexp: nested parentheses returns more tokens than
Matlab
                 Project: GNU Octave
            Submitted by: rik5
            Submitted on: Sun 07 Jul 2013 02:52:48 PM PDT
                Category: Libraries
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: Confirmed
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

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.





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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