MATLAB: A simple regex error

MATLABregexp

Hi:
I have a simple expression and trying to do a regexp, but it fails. I do not understand why the first regexp fails while the second one succeeds.:
>> str1='peak memory used 124.63 megabytes';
>> tokens=regexp(str1,'peak\s*memory\s*use(\s)*\d')
tokens =
[]
>> tokens=regexp(str1,'peak\s*memory\s*use(\s)*')
tokens =
1

Best Answer

use
tokens=regexp(str1,'peak\s*memory\s*use(\s)*d')