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

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

[Octave-bug-tracker] [bug #49659] Non-empty ouput for non-matching regex


From: Guillaume
Subject: [Octave-bug-tracker] [bug #49659] Non-empty ouput for non-matching regexp with 'names' option
Date: Mon, 21 Nov 2016 12:53:19 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0

Follow-up Comment #1, bug #49659 (project octave):

The output also differs  if there is more than one match as the output should
be a structure array but Octave creates a structure with cell arrays in
fields:


>> str='aaa 10  bbb 20';
>> regexp(str,'(?<file>\S+) (?<id>[0-9]+)','names')
ans =

  scalar structure containing the fields:

    file =
    {
      [1,1] = aaa
      [1,2] = bbb
    }
    id =
    {
      [1,1] = 10
      [1,2] = 20
    }


while Matlab does:


>> str='aaa 10  bbb 20';
>> regexp(str,'(?<file>\S+) (?<id>[0-9]+)','names')
ans = 
  1×2 struct array with fields:
    file
    id


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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