If you are using javascript, you might probably meets regular expression later or sooner.
What's the easiest way? Learning it and writing your own expression is one choice. However, as long as its something common, it is almost impossible to do better than others did that before.
So looking for code on the Internet is one best choice. What you found might have been used by millions of other programmer. After you find one, are you sure it can work and will you test it before actural using?

Manually testing is possible, but as a programmer, why not write a program to test it?

The code to create a regular expression is:
var reg = new RegExp(value, regParam);
  value is the regular expression.
  regParam can be g(globally),i(case-insensitive),m(multiline).
The code to apply it on a string is:
reg.test(str);
  str is the tested string.

With this basic testing code, it is possible to write a tester.
One working example can be found at http://daifei4321.com/jsreg/ (Prompts are in chinese)
The source code for that is the attachment of this entry.