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
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.
I think i should learn regular expression
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.
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.
Probably not what i was supposed to do, but hey it works.
I think something is broken, I passed it the s2 given in the test suite and the assertion still fails.
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.
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.
I have to admit that this solution is not general
Project Euler: Problem 3, Largest prime factor
Sum of diagonal of a square matrix
07 - Common functions and indexing 6
Back to basics - mean of corner elements of a matrix
Summing Digits within Text
Select every other element of a vector
Sort a list of complex numbers based on far they are from the origin.
Remove all the consonants
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office