MATLAB: Help on regexp to extract words between “”

regexp

aMajorLine = 'var _0x3f86=["\x72\x65\x64","\x67\x72\x65\x65\x6E","\x62\x6C\x75\x65"]';
[a,b] = regexp(aMajorLine,'var _0x3f86=\[\"([\w\\]+)\",?]+\]','tokens')
I want to extract the words inside "". The results is empty. Is there something wrong?

Best Answer

I find it difficult to debug someone else's regexp. :-(
Before seeing @Ruger28's elegant solution, I would have done
matches = regexp(aMajorLine,'"[\w*,\\]*"','match')
matches = regexprep(matches,'"','');
Note that I first pull out with the double-quote characters, then strip them out in the second line. It is possible to do this in one regexp step instead, using "lookaround" assertions, but I find that less easy to understand.