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

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

[Octave-bug-tracker] [bug #60541] Copying a returned variable from regex


From: Robert Fries
Subject: [Octave-bug-tracker] [bug #60541] Copying a returned variable from regexp results in an error message
Date: Thu, 6 May 2021 21:32:54 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0

URL:
  <https://savannah.gnu.org/bugs/?60541>

                 Summary: Copying a returned variable from regexp results in
an error message
                 Project: GNU Octave
            Submitted by: rwf1
            Submitted on: Fri 07 May 2021 01:32:52 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error or Warning
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 6.2.0
         Discussion Lock: Any
        Operating System: GNU/Linux

    _______________________________________________________

Details:

This call to regexp in octave-6.2 does not find a match (as it should) and
returns OK


[S, E, TE, M, T, NM, SP] = regexp('YYYx', 'x(?<vvv>[^x]*)x');


But copying a component of the returned variable NM results in an error
message:


xx=NM.vvv
error: invalid number of elements on RHS of assignment


The correct result is available under octave-4.2.2


[S, E, TE, M, T, NM, SP] = regexp('YYYx', 'x(?<vvv>[^x]*)x');
xx=NM.vvv
xx = {}(1x0)


This problem exists on octave releases 4.4.0, 4.4.1, 5.2, 6.1.0, and 6.2.0
although the exact error message varies.

A workaround could be


if (length(M)==0)
  xx=cell(1,0);
else
  xx=NM.vvv;
end


Note that when the problem happens that any checks to see if the variable is
really there do not flag the problem.


exist("NM")
ans = 1
isstruct(NM)
ans = 1
isfield(NM,"vvv")
ans = 1







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60541>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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