l3regex – How to make regex not match scientific notation like 2e5 – TeX
The regex functions implement the \b word boundary indicator. This does not match a character, but it matches the boundary between wordlike characters (mostly letters and numbers) and non-wordlike characters (such as spaces or certain punctuation, or the start or end of the string).
With the following regex:
\regex_replace_all:nnN { (\b[a-zA-Z_][a-zA-Z0-9_]*\b) } { \c{guuk_convertdigits:n} {\1} } \l__tmpa_tl
you therefore no longer match the e in 2e5 to the first block of [a-zA-Z_], because it is now required that this match is preceded by a boundary \b (but it is not, because the character before is 2 and between 2 and e there is no boundary).
I also added a boundary indicator at the end but this may or may not be needed.
Read more here: Source link
