www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ReturnSubstringsUsingmatchKeywordExample.m
%% Return Substrings Using match Keyword % Capture words within a character vector that contain the letter |x|. %% str = 'EXTRA! The regexp function helps you relax.'; expression = '\w*x\w*'; matchStr = regexp(str,expression,'match') %% % The regular expression |'\w*x\w*'| specifies that the character vector: % %% % * Begins with any number of alphanumeric or underscore characters, |\w*|. %% % * Contains the lowercase letter |x|. %% % * Ends with any number of alphanumeric or underscore characters after % the |x|, including none, as indicated by |\w*|.