SoFunction
Updated on 2025-03-10

Use JS to highlight the keywords specified in the article content


[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]

Multiple keywords

[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]

Copy the codeThe code is as follows:
Characters Meaning
$$ $ (JScript 5.5 or later)
$& Specifies the part of stringObj that matches the entire pattern. (JScript 5.5 or later)
$`Specifies the stringObj section before the match described by $&. (JScript 5.5 or later)
$' Specifies the stringObj section after the match described by $& . (JScript 5.5 or later)
$n The nth sub-match captured, where n is a decimal one from 1 to 9. (JScript 5.5 or later)
$nn The nnth sub-match captured, where nn is a decimal double-digit number from 01 to 99. (JScript 5.5 or later)
g, global pattern matching
i, case insensitive matching

Multiple keywords, good method, I use this way too

[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]

Why do you have to limit yourself to HTML replacement? Isn’t it more convenient to start with text objects?

[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]


[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]