% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04
% Example 1 Regular Expressions with LaTeX3
% Label: "ex:l3regex"
% arara: pdflatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
\ExplSyntaxOn
\NewDocumentCommand{\testreplace} { m }
{
 \regex_replace_all:nnN
  { \c{emph} \cB\{ (\w+) \cE\}}
  { \c{textbf} { \c{text_uppercase:n}{ \1 } } }
 #1
}
\ExplSyntaxOff 
\begin{document}
\newcommand{\teststring}{The duck said \emph{boo} to the goose.}
Original: \teststring 

\testreplace{\teststring}
Replaced: \teststring 
\end{document}
