Hi, is possible to replace a given string with another one using the replace function for an entire document?
For example I have content1.typ and content2.typ which are included in a main.typ document. Now I want to replace all occurrences of a given string inside content1.typ and content2.typ. How can I do that?
Note that #show "bla": "foo" matches “bla” but not “Bla”
You could use regex to create other matches, for instance case-insensitive or other patterns you can create with a regex.
See the following example:
// changes every encountered dolor.
#show "dolor": [*EDITED*]
// this matches cases-sensitive, so ipsum (lowercase) does not match.
#show "Ipsum": "OOPS case does not match, thus not changed"
// this regex matches cases insensitive by enabling case-insensitive mode (?i)
#show regex("(?i)whatever"): {
set text(red)
"whatEVAH"
}
= my main doc
some introduction dolor Whatever.
#include "ch1.typ"
#include "ch2.typ"