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

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

[Octave-bug-tracker] [bug #48883] regexp(rep): Matlab compatibility with


From: Rik
Subject: [Octave-bug-tracker] [bug #48883] regexp(rep): Matlab compatibility with empty match groups.
Date: Wed, 24 Aug 2016 15:56:34 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Follow-up Comment #2, bug #48883 (project octave):

See bug #38149.  It may be related.

I believe the problem is very specific to an empty match in the first
position.

As a canonical example,


regexp ('bc', '(^)(b)(c)', 'tokens')
ans = 
{
  [1,1] = 
  {
    [1,1] = b
    [1,2] = c
  }
}


But, an empty match elsewhere is okay, and returns a null token.


regexp ('bc', '(b)(a?)(c)', 'tokens', 'emptymatch')
ans = 
{
  [1,1] = 
  {
    [1,1] = b
    [1,2] = 
    [1,3] = c
  }
}


It may also be specifically related to the '^' pattern.  The example below is
almost the same as the one above, but doesn't work.


regexp ('bc', '(^a?)(b)(c)', 'tokens', 'emptymatch')
ans = 
{
  [1,1] = 
  {
    [1,1] = b
    [1,2] = c
  }
}




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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