Don't reset JS regexp lastIndex property for `contains` function

Prevent weirdness exhibited in https://gist.github.com/mg50/9579716.