Hello! I am trying to write a show rule which makes all words all in uppercase alone on a line green. The regex "^[A-Z]+$", which I am currently using is not completely working as can be seen in the picture. I have tried using "^[A-Z]+\n$" without success, as none of the words became green.
#show regex("^[A-Z]+$"): set text(green)
WORD // should match and does
a WORD // shouldn't match and doesn't
a WORD // shouldn't match but does
WORDS // should match and does
in sentence // shouldn't match and doesn't
WORDS in sentence // shouldn't match and doesn't
words IN sentence // shouldn't match and doesn't
words IN sentence // shouldn't match but does```
I'm guessing it has something to do with how typst handles linebreaks, which leaves me a bit worried that the problem is deeper than a skill issue with regex on my part. As can be seen in the picture the regex `"^[A-Z]+$"` matches when there are more than 1 spaces between two words, which I also cannot explain why it happens but to my understanding should not happen as the `^` and `$` signs should limit the matching to one line each.
Thankful for all help.