Commit 841a2617 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Replaced wildcard parameter * by ~

Otherwise, some strings may be interpreted as regular expression. The
correct syntax for selecting variables with regular expression is:




is not correct. The user must explicitely state that s/he wants to
select variables with regular expression by beginning and closing the
string with square brackets.

When a wildcard parameter is detected, the string is converted to a
regular expression by adding opening and closing square brackets and
replacing the wildcard parameter by \w*.

Consequently, in the last example, if * is the wildcard parameter,
string '\w*_US' would be converted into '[\w\w*_US]'. That is the
reason why this commit changes the wildcard parameter to ~ (which is
not used in matlab's regular expressions).
parent cf4e5cb7
......@@ -47,12 +47,12 @@ for i=1:nargin-1
% Wildcard parameter.
if ~useregularexpression
idStar = strfind(VariableName,'*');
idStar = strfind(VariableName,'~');
if ~isempty(idStar)
usewildcardparameter = true;
useregularexpression = true;
VariableName = sprintf('[%s]', VariableName);
VariableName = strrep(VariableName, '*', '\w*');
VariableName = strrep(VariableName, '~', '\w*');
% Check that square brackets are not used, unless extract method is called with a regular expression.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment