Debian Codegraph @

texmf-dist/doc/latex/datatool/datatool-user-examples/datatool-user-example001.tex

raw
1 % This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04
2 % Example 1 Regular Expressions with LaTeX3
3 % Label: "ex:l3regex"
4 % arara: pdflatex
5 % arara: pdfcrop
6 \documentclass[12pt]{article}
7 \pagestyle{empty}
8 \ExplSyntaxOn
9 \NewDocumentCommand{\testreplace} { m }
10 {
11 \regex_replace_all:nnN
12 { \c{emph} \cB\{ (\w+) \cE\}}
13 { \c{textbf} { \c{text_uppercase:n}{ \1 } } }
14 #1
15 }
16 \ExplSyntaxOff
17 \begin{document}
18 \newcommand{\teststring}{The duck said \emph{boo} to the goose.}
19 Original: \teststring
20
21 \testreplace{\teststring}
22 Replaced: \teststring
23 \end{document}