diff --git a/static/js/copy_and_paste.js b/static/js/copy_and_paste.js index 649ee2d1d3..2c3e55f616 100644 --- a/static/js/copy_and_paste.js +++ b/static/js/copy_and_paste.js @@ -318,7 +318,7 @@ exports.paste_handler = function (event) { if (paste_html && page_params.development_environment) { const text = exports.paste_handler_converter(paste_html); const mdImageRegex = /^!\[.*]\(.*\)$/; - if (text.match(mdImageRegex)) { + if (mdImageRegex.test(text)) { // This block catches cases where we are pasting an // image into Zulip, which is handled by upload.js. return; diff --git a/static/js/typeahead_helper.js b/static/js/typeahead_helper.js index d51e4f1e7c..0569157187 100644 --- a/static/js/typeahead_helper.js +++ b/static/js/typeahead_helper.js @@ -37,7 +37,7 @@ exports.highlight_with_escaping_and_regex = function (regex, item) { let result = ""; for (const piece of pieces) { - if (piece.match(regex)) { + if (regex.test(piece)) { result += "" + Handlebars.Utils.escapeExpression(piece) + ""; } else { result += Handlebars.Utils.escapeExpression(piece);