diff --git a/ghost/admin/app/components/gh-search-input.js b/ghost/admin/app/components/gh-search-input.js
index f283560365..99ee868225 100644
--- a/ghost/admin/app/components/gh-search-input.js
+++ b/ghost/admin/app/components/gh-search-input.js
@@ -14,9 +14,9 @@ export function computedGroup(category) {
}
return this.get('content').filter((item) => {
- let search = new RegExp(this.get('currentSearch'), 'ig');
+ let search = this.get('currentSearch').toString().toLowerCase();
- return (item.category === category) && item.title.match(search);
+ return (item.category === category) && (item.title.toString().toLowerCase().indexOf(search) >= 0);
});
});
}
diff --git a/ghost/admin/app/helpers/highlighted-text.js b/ghost/admin/app/helpers/highlighted-text.js
index 1dcc2ad40b..12ef0cedbe 100644
--- a/ghost/admin/app/helpers/highlighted-text.js
+++ b/ghost/admin/app/helpers/highlighted-text.js
@@ -2,7 +2,10 @@ import {helper} from '@ember/component/helper';
import {htmlSafe} from '@ember/string';
export function highlightedText([text, termToHighlight]) {
- return htmlSafe(text.replace(new RegExp(termToHighlight, 'ig'), '$&'));
+ // replace any non-word character with an escaped character
+ let sanitisedTerm = termToHighlight.replace(new RegExp(/\W/ig), '\\$&');
+
+ return htmlSafe(text.replace(new RegExp(sanitisedTerm, 'ig'), '$&'));
}
export default helper(highlightedText);