Check out "Do you speak JavaScript?" - my latest video course on advanced JavaScript.
Language APIs, Popular Concepts, Design Patterns, Advanced Techniques In the Browser
There should be some super cool RegEx, which I can use. However after short research I wasn't able to find it. So, I created a simple function which does the job.