regexprep with multiple expression

Hi,
Is there a way to consolidate these regexprep into one expression? regexprep(ttxt, ' parish',''); regexprep(ttxt, ' borough',''); regexprep(ttxt, ' census area','');
ttxt is a cell array.
Thanks.

回答 (2 件)

Daniel Shub
Daniel Shub 2012 年 8 月 24 日

2 投票

Is this what you want?
ttxt = 'hello parish world borough foo census area bar';
regexprep(ttxt, ' parish| borough| census area','')
Pete sherer
Pete sherer 2012 年 8 月 24 日

0 投票

Yes. Thanks

1 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 8 月 24 日
this is not an answer. if you are satisfied, you have to click on "accept answer"

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeApp Building についてさらに検索

タグ

質問済み:

2012 年 8 月 24 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by