Search function similar to window.find with support for regular expressions.