Fix problem that write bracket causes crash.

Sorry for sudden pull-request.
When write a regular expression escape sequences like brackets in editor causes crash in Linux.
Cause of this problem is using "search" method.
I fix to use "indexOf" method.

It problem write in #54 .