Themes: Improve RegExp pattern for search.

* The replacement of spaces is now done globally.
* The search term is now escaped for RegExp meta characters.

props westonruter for the hint.
fixes #27479.
Built from https://develop.svn.wordpress.org/trunk@27649


git-svn-id: http://core.svn.wordpress.org/trunk@27492 1a063a9b-81f0-0310-95a4-ce76da25c4cd