Mercurial > hg > octave-terminal
changeset 12469:0ee8d7d60c82
Use single quotes around regexp patterns.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Tue, 22 Feb 2011 12:45:30 -0800 |
parents | 46b3883d800c |
children | 64ae43e0e1c0 |
files | scripts/ChangeLog scripts/io/strread.m scripts/plot/whitebg.m scripts/strings/regexptranslate.m scripts/testfun/runtests.m test/ChangeLog test/fntests.m |
diffstat | 7 files changed, 18 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2010-02-22 Rik <octave@nomad.inbox5.com> + + * io/strread.m, plot/whitebg.m, strings/regexptranslate.m, + testfun/runtests.m: Use single quotes around regexp patterns. + 2010-02-20 Karsten Trulsen <karstent@math.uio.no> * signal/fftshift.m: Fix broken function. Bug 32442.
--- a/scripts/io/strread.m +++ b/scripts/io/strread.m @@ -188,7 +188,7 @@ ## Determine the number of words per line format = strrep (format, "%", " %"); - [~, ~, ~, fmt_words] = regexp (format, "[^ ]+"); + [~, ~, ~, fmt_words] = regexp (format, '[^ ]+'); num_words_per_line = numel (fmt_words); for m = 1:numel(fmt_words) @@ -240,7 +240,7 @@ function out = split_by (text, sep) sep = union (sep, "\n"); - pat = sprintf ("[^%s]+", sep); + pat = sprintf ('[^%s]+', sep); [~, ~, ~, out] = regexp (text, pat); out(cellfun (@isempty, out)) = {""}; out = strtrim (out);
--- a/scripts/plot/whitebg.m +++ b/scripts/plot/whitebg.m @@ -74,7 +74,7 @@ if (isroot) fac = get (0, "factory"); fields = fieldnames (fac); - fieldindex = intersect (find (!cellfun (@isempty, regexp(fields, '.*color.*'))), union (find (!cellfun (@isempty, regexp(fields, 'factoryaxes.*'))), find (!cellfun (@isempty, regexp(fields, 'factoryfigure.*'))))); + fieldindex = intersect (find (!cellfun (@isempty, regexp(fields, 'color'))), union (find (!cellfun (@isempty, regexp(fields, 'factoryaxes.*'))), find (!cellfun (@isempty, regexp(fields, 'factoryfigure.*'))))); ## Check whether the factory value has been replaced for nf = 1 : numel (fieldindex); @@ -104,7 +104,7 @@ for nh = 1 : numel(h) p = get (h (nh)); fields = fieldnames (p); - fieldindex = find (!cellfun (@isempty, regexp(fields, '.*color.*'))); + fieldindex = find (!cellfun (@isempty, regexp(fields, 'color'))); if (numel (fieldindex)) for nf = 1 : numel (fieldindex); field = fields {fieldindex (nf)}; @@ -121,7 +121,7 @@ def = get (h (nh), "default"); fields = fieldnames (def); if (! isempty (fields)) - fieldindex = find (!cellfun (@isempty, regexp(fields, '.*color.*'))); + fieldindex = find (!cellfun (@isempty, regexp(fields, 'color'))); for nf = 1 : numel (fieldindex) defaultfield = fields {fieldindex (nf)}; defaultvalue = 1 - subsref (def, struct ("type", ".", "subs", defaultfield));
--- a/scripts/strings/regexptranslate.m +++ b/scripts/strings/regexptranslate.m @@ -60,8 +60,8 @@ if (ischar (op)) op = tolower (op); if (strcmp ("wildcard", op)) - y = regexprep (regexprep (regexprep (s, "\\.", "\\."), "\\*", - ".*"), "\\?", "."); + y = regexprep (regexprep (regexprep (s, '\.', '\.'), '\*', + '.*'), '\?', '.'); elseif (strcmp ("escape", op)) ch = {'\$', '\.', '\?', '\[', '\]'}; y = s;
--- a/scripts/testfun/runtests.m +++ b/scripts/testfun/runtests.m @@ -80,7 +80,7 @@ if (fid >= 0) str = fread (fid, "*char")'; fclose (fid); - retval = ! isempty (regexp (str, "^%!(test|assert|error|warning)", "lineanchors")); + retval = ! isempty (regexp (str, '^%!(test|assert|error|warning)', "lineanchors")); else error ("runtests: fopen failed: %s", f); endif
--- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2010-02-22 Rik <octave@nomad.inbox5.com> + + * fntests.m: Use single quotes around regexp patterns. + 2010-02-19 Rik <octave@nomad.inbox5.com> * fntests.m: Use PCRE regular expressions to simplify script.
--- a/test/fntests.m +++ b/test/fntests.m @@ -91,7 +91,7 @@ if (fid >= 0) str = fread (fid, "*char")'; fclose (fid); - retval = ! isempty (regexp (str, "^%!(test|assert|error|warning)", "lineanchors")); + retval = ! isempty (regexp (str, '^%!(test|assert|error|warning)', "lineanchors")); else error ("fopen failed: %s", f); endif