 <p>Will this work for you?</p> <pre><code>String.prototype.regexIndexOf = function(regex, startpos) { var indexOf = this.substring(startpos || 0).search(regex); return (indexOf &gt;= 0) ? (indexOf + (startpos || 0)) : indexOf; } </code></pre> <p>See <a href="http://jsfiddle.net/rCn3Q/2/" rel="nofollow">JSfiddle</a></p>