Behavior of the matlab regexptranslate function
Ben Abbott
bpabbott at mac.com
Fri Mar 21 13:17:39 CDT 2008
On Friday, March 21, 2008, at 12:32PM, "David Bateman" <David.Bateman at motorola.com> wrote:
>I just looked at the regexptranslate function, as it seems this function
>might be useful. In matlab2007b and the documentation of matlab2008a
>there is an incoherence in the real and documented behavior of this
>function.. Read the documentation and looking at It seems that
>regexptranslate ("wildcard", s) might be trivally written as
>
>regexprep(regexprep(regexprep (s,"\\.","\\."),"\\*",".*"),"\\?",".")
>
>and that is exactly how it works in matlab2007b. However the example for
>2008a at
>
>http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/regexptranslate.html
>
>has the example
>
>files = ['test1.mat, myfile.mat, newfile.txt, ' ...
>'jan30.mat, table3.xls'];
>regexp(files, regexptranslate('wildcard', '*.mat'), 'match')
>ans =
>'test1.mat' 'myfile.mat' 'jan30.mat'
>
>and its states that
>
>regexptranslate('wildcard','*.mat')
>ans =
>\w+\.mat
>
>So what do the "?" and "*" characters really become in matlab2008a after
>the use of regexptranslate? Can someone with a copy on 2008a run a
>couple of tests for me? In any case there is a large discrepancy between
>the matlab documented and real behavior of this function.
>
>D.
>
David,
I have a license, but have not yet installed it.
Please post the tests, and if no one steps up, I'll install 2008a and run them.
Ben
More information about the Octave-maintainers
mailing list