diff --git a/matlab/dynare.m b/matlab/dynare.m
index cbd5f1ac01abcbace81171bbc4c68895bfb76bb3..c0ab33337791440dc4e81b4f9c4a068384259ccd 100644
--- a/matlab/dynare.m
+++ b/matlab/dynare.m
@@ -199,9 +199,9 @@ fclose(fid);
 if regexp(firstline, '\s*\/\/', 'once') == 1
     firstline = regexprep(firstline, '\s*\/\/', '');
     if ~isempty(regexp(firstline, '(^\s*\-\-\+\s*options:\s*)', 'once')) ...
-        && ~isempty(regexp(firstline, '(\s*\+\-\-(\s*\w*\s*)*$)', 'once'))
+        && ~isempty(regexp(firstline, '(\s*\+\-\-.*$)', 'once'))
         firstline = regexprep(firstline, '(^\s*\-\-\+\s*options:\s*)', '');
-        firstline = regexprep(firstline, '(\s*\+\-\-(\s*\w*\s*)*$)', '');
+        firstline = regexprep(firstline, '(\s*\+\-\-.*$)', '');
         dynoption = strsplit(firstline, {' ', ','});
         if isequal(nargin, 1)
             varargin = dynoption;