www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/UpdateaSingleStringExample.m

    %% Update Text  
% Replace words that begin with |M|, end with |y|, and have at least one
% character between them.   

%%  
str = 'My flowers may bloom in May';
expression = 'M(\w+)y';
replace = 'April';

newStr = regexprep(str,expression,replace)