Please explain how to understand special strings like '^(\w:)?\'
古いコメントを表示
I am trying to understand some m-files I find on this forum, but am stumped a bit by some of the strings statements used. Below are a few snippets that come from deploypcode by Sven.
Example 1:
function inPath = getFullPathStr(inPath)
% Tricky little function that returns the fully qualified path by looking for filesep
inPath = fullfile(inPath);
if ~any(regexp(inPath,['^(\w:)?\' filesep]))
inPath = fullfile(pwd, inPath);
end
end
Example 2:
mustIgnoreList = {'^\.$','^\.\.$',[mfilename '.m']};
tmp = {'\.dll$'}
My questions
- Why is fullfile not sufficient to get the full file path, why does Sven need to check with the following regexp function?
- How do I interpret '^(\w:)?\' ?
- In example 2, how do I interpret {'^\.$','^\.\.$',[mfilename '.m']} ? I understand he is concatenating chars, but what does the '^\.$' mean exactly?
- In {'\.dll$'}, what does the ending with a $ imply?
Thanks
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Characters and Strings についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!