MATLAB: Does the computer’s locale affect the results of regular expressions in MATLAB

MATLAB

MATLAB's regular expression documentation states that:
\w represents any alphabetic, numeric, or underscore character. For English character sets, \w is equivalent to [a-zA-Z_0-9]
see: <http://www.mathworks.com/help/matlab/matlab_prog/regular-expressions.html>
I am using a non-English locale on my computer, so what does \w match?

Best Answer

The \w metacharacter will match any "alphanumeric" character as defined by Unicode, which is locale independent.
For example:
str = 'Mit luftpudefartøj er fyldt med ål';
regexp(str,'\w*','match')
ans =
'Mit' 'luftpudefartøj' 'er' 'fyldt' 'med' 'ål'
In this example the characters ø and å are matched, even though they are not part of the standard English character set. The results of this code would be the same when run on a computer with any locale.