[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Behavior of the matlab regexptranslate function
From: |
David Bateman |
Subject: |
Behavior of the matlab regexptranslate function |
Date: |
Fri, 21 Mar 2008 17:25:48 +0100 |
User-agent: |
Thunderbird 2.0.0.12 (X11/20080306) |
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 Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
- Behavior of the matlab regexptranslate function,
David Bateman <=
- Re: Behavior of the matlab regexptranslate function, Ben Abbott, 2008/03/21
- Re: Behavior of the matlab regexptranslate function, David Bateman, 2008/03/21
- Re: Behavior of the matlab regexptranslate function, Ben Abbott, 2008/03/21
- Re: Behavior of the matlab regexptranslate function, David Bateman, 2008/03/21
- Re: Behavior of the matlab regexptranslate function, Ben Abbott, 2008/03/21
- [Changeset] Re: Behavior of the matlab regexptranslate function, David Bateman, 2008/03/23
- [Changeset] Re: Behavior of the matlab regexptranslate function, John W. Eaton, 2008/03/24