I'm pretty sure this init() function is called every time the keyboard pops up, so this isnt the right place to initialize the regexp.  You could just put the code at the top-level instead so it only runs once.