Mercurial > hg > octave-terminal
changeset 13311:d590d9df5596
regexprep: only return cell array if first arg is cell array
* regexp.cc (Fregexprep): Only return cell array if first argument
is originally a cell array.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 10 Oct 2011 15:08:48 -0400 |
parents | 583940a28bfd |
children | e84d512b2438 |
files | src/DLD-FUNCTIONS/regexp.cc |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/regexp.cc +++ b/src/DLD-FUNCTIONS/regexp.cc @@ -1703,7 +1703,8 @@ } if (!error_state) - retval = octave_value (ret); + retval = args(0).is_cell () + ? octave_value (ret) : octave_value (ret(0)); } } else @@ -1759,7 +1760,7 @@ %!assert(regexprep("abc","(b)","$1.."),"ab..c"); ## Test cell array arguments -%!assert(regexprep("abc",{"b","a"},"?"),{"??c"}) +%!assert(regexprep("abc",{"b","a"},"?"),"??c") %!assert(regexprep({"abc","cba"},"b","?"),{"a?c","c?a"}) %!assert(regexprep({"abc","cba"},{"b","a"},{"?","!"}),{"!?c","c?!"})