gusucode.com > 《精通matlab 7》包括配套光盘 > 配套光盘里的程序附件/Ex-07/Ex0712.m
%例7-12 正则表达式简单应用 stra = 'bat cat can car COAT court cut ct CAT-scan'; regexpi(stra, 'c[aeiou]+t') %匹配c*t模式的字符串,其中*是aeiou中的某一个字符 strb = {'Madrid, Spain' 'Romeo and Juliet' 'MATLAB is great'}; s1 = regexp(strb, '[A-Z]'); %匹配大写字母 s2 = regexp(strb, '\s'); %匹配空格字符 celldisp(s1) celldisp(s2)