I am trying to make a script that should replace strings. This is what my current replace function does:
let message2 = message1.replace(/hello/g, "[size=medium]h[/size]ello");
As you can see, this adds the size=medium tag to the h of the word. This works good, but I want this to work in every possible capitalization and still remain in that capitalization.
For example:
"hELLo" should be replaced with "[size=medium]h[/size]ELLo"
and
"HELLo" be replaced with "[size=medium]H[/size]ELLo"
Only the h/H should be wrapped in the tag, but I am not sure how to perform something like this. Big thanks for any input on this!