regexprep(s1, '(\w*)ain', '')
not working pls help me
Hi harish, so the if you see the regexprep documentation, it will tell you when you execute, it will remove every word which contains the letters ain in the expression. You can verify this on your system. To solve this, you need to look for a way to use regexprep such that it only looks for the letters in the end of the word.
Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
%%
s1 = 'The rain in Spain falls mainly on the plain';
s2 = 'The in falls mainly on the ';
assert(strcmp(remAin(s1),s2));
Error: Assertion failed.
|
2 | Fail |
%%
s1 = 'The pain from my migraine makes me complain';
s2 = 'The from my migraine makes me ';
assert(strcmp(remAin(s1),s2));
Error: Assertion failed.
|
3 | Pass |
%%
s1 = 'I had to explain that "ain" is not a word';
s2 = 'I had to that "" is not a word';
assert(strcmp(remAin(s1),s2));
ans =
I had to that "" is not a word
|
650 Solvers
198 Solvers
151 Solvers
276 Solvers
Back to basics - mean of corner elements of a matrix
237 Solvers