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