The question is marked as javascript string.
I wrote a simple answer which uses regular expressions. Do I really need to say that I'm using regular expressions when there is a regexp literal in a single line of code?
It's part of the language, not a special library. I assume the reader is aware of language syntax.
Asked because of comments to this answer:
may be you need to mention that this solution requires regex – Reddy 1 hour ago
@Reddy, isn't it clear from regex literal in the code? – Qwertiy 1 hour ago
@Qwertiy its only because the OP doesn't have a regex tag added to it. Also we cant be sure that beginners can even identify that literal as a `regex'. – Reddy 11 mins ago