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: Markus Mützel
Subject: [Octave-bug-tracker] [bug #60541] Copying a returned variable from regexp results in an error message
Date: Fri, 7 May 2021 05:51:42 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36 Edg/90.0.818.51

Update of bug #60541 (project octave):

                  Status:                    None => Invalid                
             Open/Closed:                    Open => Closed                 
        Operating System:               GNU/Linux => Any                    

    _______________________________________________________

Follow-up Comment #1:

Confirmed with Octave 6.2.0 on Windows.

Fwiw, with Matlab R2021a:

>> [S, E, TE, M, T, NM, SP] = regexp('YYYx', 'x(?<vvv>[^x]*)x');
>> xx=NM.vvv
Insufficient number of outputs from right hand side of equal sign to satisfy
assignment.
 
>> 


So Octave seems to be compatible with this respect.

IIUC, `NM.vvv` returns an empty comma-separated-list if `NM` is empty. Hence,
it cannot be assigned to a variable.
See also: https://octave.org/doc/v6.2.0/Comma-Separated-Lists.html

The following is valid syntax:

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


The braces in the last assignment convert the cs-list to a cell which is
allowed to be empty in an assignment.


    _______________________________________________________

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]