Fix regexp search & replace.

Fix incorrect flag check in search and replace.