summaryrefslogtreecommitdiff
path: root/library/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-04-01 19:34:49 +0200
committerLaurenz <laurmaedje@gmail.com>2023-04-01 19:34:49 +0200
commit10a3fbd174fc1a3f95937c9120d478c8e94c277d (patch)
tree6f2f5f3b1c7fd81854152bcc994ba05db7944a75 /library/src
parent2d6a79ba32f6c075ea84cc1b6496b91a1e993058 (diff)
Documentation for regex from raw element
Fixes #266.
Diffstat (limited to 'library/src')
-rw-r--r--library/src/compute/construct.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/src/compute/construct.rs b/library/src/compute/construct.rs
index 04195f42..e7e05eee 100644
--- a/library/src/compute/construct.rs
+++ b/library/src/compute/construct.rs
@@ -383,6 +383,10 @@ pub fn regex(
/// escape sequences. To produce regex escape sequences that are also valid in
/// Typst (e.g. `[\\]`), you need to escape twice. Thus, to match a verbatim
/// backslash, you would need to write `{regex("\\\\")}`.
+ ///
+ /// If you need many escape sequences, you can also create a raw element
+ /// and extract its text to use it for your regular expressions:
+ /// ```{regex(`\d+\.\d+\.\d+`.text)}```.
regex: Spanned<EcoString>,
) -> Value {
Regex::new(&regex.v).at(regex.span)?.into()