12 Quick Example References for Javascript Regular Expressions
1. Search for a substring:
var str = "The quick brown fox jumps over the lazy dog"
n = str.search(/fox/);
16
For something as simple as searching a searching a string, you could use String.indexOf or String.search for faster performance.
2. If a string starts with a substring: