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

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

[Octave-bug-tracker] [bug #38149] regexp doesn't return empty tokens --


From: anonymous
Subject: [Octave-bug-tracker] [bug #38149] regexp doesn't return empty tokens -- they just disappear
Date: Wed, 23 Jan 2013 10:55:07 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0

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

                 Summary: regexp doesn't return empty tokens -- they just
disappear
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Wed 23 Jan 2013 10:55:06 AM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.6.2
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

Parenthesized subexpressions create tokens. If the subexpression matches an
empty string, an empty string should be returned. Now they just disappear: If
I have an expression with two parenthesized subexpressions and the first match
empty, only the second token is returned. This is inconsistent with other
regex implementations like perl and MATLAB.

This works:
t=regexp('1bar2','^(\d*)bar(\d*)$','tokens'); 
isequal(t{1}{2},'2')

This doesn't:
t=regexp('bar2','^(\d*)bar(\d*)$','tokens'); 
isequal(t{1}{2},'2')

t=regexp('bar2','^(foo)?bar(\d*)$','tokens');
isequal(t{1}{2},'2')





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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