regexp command expr(?!test) assertion fail

While using regexp command in following example :
I am expecting result to be 'Retiring' 'lovable' 'runtastic' but instead I am getting the following result:
Can someone please explain why is it so?

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 9 月 19 日

0 投票

Commencement matches \w* because it all word forming characters. It is followed by something that is not 'ment ' because the space after Commencement is not 'm'.

3 件のコメント

Satyam Agrawal
Satyam Agrawal 2020 年 9 月 19 日
How can I correct it? Any ideas ?
madhan ravi
madhan ravi 2020 年 9 月 19 日
regexprep(str, '.*(ment)','')
Satyam Agrawal
Satyam Agrawal 2020 年 9 月 19 日
Thanks ! It works.

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

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

製品

リリース

R2017b

質問済み:

2020 年 9 月 19 日

コメント済み:

2020 年 9 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by