Problem 31. Remove all the words that end with "ain"
Solution Stats
Problem Comments
-
6 Comments
This problem is fantastic to improve his knowledge with regular expressions!
I have rescored the leading problem to make sure its not zero
I learned so much about the regexp and strjoin functions because of this problem. Thank you!
I agree... This problem improved my knowledge of regexp. Although my code is running well in my computer but not here. I'm using R2015a. Can anyone please help ! Thank you
Did it in two steps, so many functionality in regexp that I discovered for myself today.. )
nice problem..really nic
Solution Comments
-
1 Comment
I think the second half of the program is right, and I repeatedly tested multiple sets of sentences, but it just didn 't pass.I don't know why.
-
1 Comment
The problem is not well defined. In test 3 one can see that double quotes should be left alone.
As it is, solutions that only check single words in double quotes will be correctly handled, but not necessarily multiple words (sentence/s) enclosed in double quotes. An additional test should verify, for instance, that the following is correctly handled:
S1 = '"The rain in Spain"'
And of course there could be nested double quotes... A water tight definition is required her.
-
1 Comment
I think i should learn regular expression
-
1 Comment
wow
-
1 Comment
Hi all, I just can't find out why the assertion fails. All works well on my MALTAB but not here. Both codes (commented and not) remove only the words which end with 'ain' and leave the two spaces but still the assertions here has failed.
-
3 Comments
This passes in R2017b, yet fails here. Why?
Actually this code won't pass the Test Suite on any version of MATLAB. The misunderstanding is caused by rendering of HTML text on Cody, which means that double-spaces are not _displayed_ in the Test Suite's solutions; nevertheless, the correct solutions do contain double spaces, as you can confirm by viewing the HTML source, and as also explained in the problem statement. Your code is removing some spaces. I'm sure you can fix it now, with this knowledge.
Thanks for clarifying. I appreciate it.
-
1 Comment
Probably not what i was supposed to do, but hey it works.
-
1 Comment
I think something is broken, I passed it the s2 given in the test suite and the assertion still fails.
-
1 Comment
Took me nearly one hour to solve (though not complete,for just "ain,it is wrong).But I think it's great.I recently learn regular expressions.
-
2 Comments
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.
-
1 Comment
I have to admit that this solution is not general
Problem Recent Solvers1856
Suggested Problems
-
554 Solvers
-
Convert a vector into a number
579 Solvers
-
444 Solvers
-
The Answer to Life, the Universe, and Everything
484 Solvers
-
652 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!