diff --git a/web/src/copy_and_paste.ts b/web/src/copy_and_paste.ts index 80cc2315e1..48d8188367 100644 --- a/web/src/copy_and_paste.ts +++ b/web/src/copy_and_paste.ts @@ -567,7 +567,7 @@ export function paste_handler_converter(paste_html: string): string { const className = codeElement.getAttribute("class") ?? ""; const language = node.parentElement?.classList.contains("zulip-code-block") ? (node.closest(".codehilite")?.dataset?.codeLanguage ?? "") - : (className.match(/language-(\S+)/) ?? [null, ""])[1]; + : (/language-(\S+)/.exec(className) ?? [null, ""])[1]; assert(options.fence !== undefined); const fenceChar = options.fence.charAt(0); diff --git a/web/src/input_pill.ts b/web/src/input_pill.ts index 640f8dd47d..faae34c061 100644 --- a/web/src/input_pill.ts +++ b/web/src/input_pill.ts @@ -170,7 +170,7 @@ export function create( if (value.length === 0) { return true; } - if (store.split_text_on_comma && value.match(",")) { + if (store.split_text_on_comma && value.includes(",")) { funcs.insertManyPills(value); return false; } diff --git a/web/src/lightbox.ts b/web/src/lightbox.ts index 4591389d35..4f57227fb4 100644 --- a/web/src/lightbox.ts +++ b/web/src/lightbox.ts @@ -397,7 +397,7 @@ export function build_open_media_function( const payload = parse_media_data(util.the($media)); assert(payload !== undefined); - if (payload.type.match("-video")) { + if (payload.type.includes("-video")) { display_video(payload); } else if (payload.type === "image") { display_image(payload); @@ -509,7 +509,7 @@ export function parse_media_data(media: HTMLMediaElement | HTMLImageElement): Pa let original_width_px; let original_height_px; if (original_dimensions) { - const found = original_dimensions.match(/^(\d+)x(\d+)$/); + const found = /^(\d+)x(\d+)$/.exec(original_dimensions); if (found) { original_width_px = Number(found[1]); original_height_px = Number(found[2]); diff --git a/web/src/util.ts b/web/src/util.ts index daf55c007a..9c1b604fe4 100644 --- a/web/src/util.ts +++ b/web/src/util.ts @@ -198,8 +198,8 @@ export function find_stream_wildcard_mentions(message_content: string): string | // We cannot use the exact same regex as the server side uses (in zerver/lib/mention.py) // because Safari < 16.4 does not support look-behind assertions. Reframe the lookbehind of a // negative character class as a start-of-string or positive character class. - const mention = message_content.match( - /(?:^|[\s"'(/<[{])(@\*{2}(all|everyone|stream|channel)\*{2})/, + const mention = /(?:^|[\s"'(/<[{])(@\*{2}(all|everyone|stream|channel)\*{2})/.exec( + message_content, ); if (mention === null) { return null;