0

I inherited a code that contains the following line:

save('AllVars.mat', '-regexp', '^(?!(runData)$).');

From what I understand, this line saves all variables in the workspace except for runData. But I can't quite understand how does ^(?!(runData)$). do the job and I couldn't find a source that can tell me this either (I don't quite know how to search for it either).

Can someone help me interpret the purpose of the symbols?

Paolo
  • 10,935
  • 6
  • 23
  • 45
Jesse Feng
  • 85
  • 9
  • 1
    Search for regular expressions. That string is a regular expression. That's what the `'-regexp'` input parameter is referring to. – Andras Deak Oct 02 '18 at 21:40
  • `^` is anchor for beginning of string, `(?!` denotes a negative lookahead, `runData` is the literal substring, `$` is end of string and `.` matches any character. – Paolo Oct 02 '18 at 22:13

0 Answers0