finding a specific word after another word in a text

Julia on 5 Feb 2021
Latest activity Reply by Adib Yusof on 11 Feb 2021

ok I want to extract all those rows in a table where one column has strings in which it shall contain the word "change" specifically after the word "terms" . text is : May not be redeemed for cash or combined with any other offer or coupon. Not valid on clearance (merchandise ending in .98). May not be applied to taxes, previous purchases, or the purchase of gift cards. Non-transferable. Terms are subject to change at any time. Product styles are subject to availability. See store associate for details.

Adib Yusof
Adib Yusof on 11 Feb 2021

Say Tbl is the table and Text is the column (or the variable) of the strings in Tbl:

FilteredTbl = Tbl(contains(Tbl.Text, "Terms") & contains(Tbl.Text, "change"), :);
Christopher Stapels
Christopher Stapels on 5 Feb 2021

Have a look at the documentation for strfind You will definitely get more reach if you post this question in MATLAB answers , perhaps we should drop the discussions down lower on the page. Thanks for taking part in our new community!