tikz latex3 add tag
Girish
In the following code, I am trying to put arc over the text between <...>. I am using this particular way because it fits as a part in a bigger code. 

The following code should replace all <...> with arc over the text inside but it only replaces the last occurrence of <...>, I don't understand why.


```
\documentclass{article}
\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\ExplSyntaxOn

\tl_const:Nx \c_colon_tl { \token_to_str:N : }
\tl_new:N \l_names_tl
\tl_put_right:Nx \l_names_tl {abcdefghijklmnopqrstuvwxyz} 
\int_new:N \l_counter_int
\tl_new:N \l_aa_tl
\tl_new:N \l_bb_tl
\tl_new:N \l_cc_tl


\NewDocumentCommand\barr{m}
{
	\tl_set:Nn \l_aa_tl {#1}

	\int_set:Nn \l_counter_int {1}
	\int_while_do:nNnn {\l_counter_int}<{27}
	{	
		\tl_set:Nx \l_bb_tl {\tl_item:Nn \l_names_tl{\l_counter_int}}
		\tl_set:Nx \l_cc_tl {\tl_item:Nn \l_names_tl{\l_counter_int+1}}

		\tl_replace_once:Nnn \l_aa_tl {<} { \tikzmark{\l_bb_tl} }
		\tl_replace_once:Nnn \l_aa_tl {>} { \tikzmark{\l_cc_tl} }
		
		\tikz[remember~picture,overlay,baseline=0pt,transform~canvas={yshift=1em}] \draw (pic~cs \c_colon_tl \l_bb_tl) edge[bend~left] (pic~cs \c_colon_tl \l_cc_tl);  
		
		\int_add:Nn \l_counter_int{2} 	     
	}

	\tl_use:N \l_aa_tl
}



\ExplSyntaxOff

\begin{document}
\barr{ab<cde>fghi <jkl>mnopqr<stu>vw}
 
\end{document}
``` 
In place of `\tl_replace` if I use 
```
\regex_replace_once:nnN  {<} { \c{tikzmark}\cB{\c{l_bb_tl}\cE} } \l_aa_tl
\regex_replace_once:nnN  {>} { \c{tikzmark}\cB{\c{l_cc_tl}\cE} } \l_aa_tl
 ```
 How to make it work?
Top Answer
user 3.14159
Ti*k*Z/pgf comes with the `parser` module that can be used to address the questions raised in the comments. (There is one thing that I could not make work: spaces. However, perhaps @Skillmon sees this and tells us what to do, and perhaps updates the pgf manual.) Note also that all this is very similar to the `simpler-wick` package except of course that you do not want to use macros like `\c`. If you want to consider using `\c` instead of `<` and `>`, one could use the `simpler-wick`

```
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usepgfmodule{parser}
\newcounter{tml}\newif\iftml\tmlfalse
\newcounter{tmr}
\newcommand{\barr}[1]{%
	\edef\temp{\noexpand\pgfparserparse{Girish}#1;}%
	\temp
}
\pgfparserdef{Girish}{all};{\pgfparserswitch{final}}% 
% according to how I read the manual this should work but doesn't
\pgfparserdef{Girish}{all}{\meaning\space}{~}% 
\pgfparserdef{Girish}{all}<{\stepcounter{tml}\tmltrue}% 
\pgfparserdef{Girish}{all}>{\stepcounter{tmr}%
\unless\ifnum\value{tml}<\value{tmr}\relax
\begin{tikzpicture}[remember picture,overlay]
 \draw ([yshift=1em]tml-\number\value{tmr}.base west) to[bend left]
  ([yshift=1em]tmr-last.base east);
\end{tikzpicture}%
\fi}% 
\pgfparserdefunknown{Girish}{all}%
{\iftml\tikzmarknode{tml-\number\value{tml}}{\pgfparserletter}\tmlfalse
\else
\tikzmarknode{tmr-last}{\pgfparserletter}%
\fi
}% 
\pgfparserset{Girish/silent=true}%
\begin{document}
\barr{ab<cde>fghi <jkl>mnopqr<stu>vw}\par\bigskip

\barr{pft<test>purr <meow>}\par\bigskip

\barr{pft<test<purr>meow>}
\end{document}
```

![Screen Shot 2020-07-08 at 11.28.55 AM.png](/image?hash=817492c81ecff8cf4adc8d72e9c99027a61a06f45d8d37af506cd7356acc851d)

As you can see, it also supports overlapping "contractions", and of course, given well-defined prescriptions, one could make it more versatile.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.