%% Include Captured Tokens in Word Replacement
% Replace variations of the word "walk" by capturing the letters that follow "walk".

documents = tokenizedDocument([
    "I walk"
    "they walked"
    "we are walking"])
expression = "walk(\w*)";
replace = "ascend$1";
newDocuments = regexprep(documents,expression,replace)

% Copyright 2012 The MathWorks, Inc.