Use `Y.Escape.regex()` for this: http://yuilibrary.com/yui/docs/api/classes/Escape.html#method_regex