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?

Antworten (1)

Walter Roberson
Walter Roberson am 19 Sep. 2020

0 Stimmen

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 Kommentare

Satyam Agrawal
Satyam Agrawal am 19 Sep. 2020
How can I correct it? Any ideas ?
regexprep(str, '.*(ment)','')
Satyam Agrawal
Satyam Agrawal am 19 Sep. 2020
Thanks ! It works.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2017b

Gefragt:

am 19 Sep. 2020

Kommentiert:

am 19 Sep. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by