# [luatex] Library for regular expressions in lualatex

Henri Menke henrimenke at gmail.com
Tue Jun 11 04:05:04 CEST 2019

On 11/06/2019, 04:17:15, Саша Козловский wrote:
> Hello Henri. Maybe you right,and regexp is not good way. May be exists ways
> to redefine $$and  in lualatex,because i want,that for formulas with$$
> and $inserted actualtext,so i decided use lua callbacks,to replace it in [] > or (),because in this redefined commands i do insertion of actualtext in > formula. May be you know another ways,how insert actualtext in formulas with > $$or (actualtext must contains tex notation of this formula)? Thanks very > mutch everybody for the any help and any ideas. If the only delimiters to your math environments are and$$, then you can just use the \everymath and \everydisplay hooks to grab the contents of the environment. Keep in mind that this will fix catcodes, so verbatim material will not work. \def\actualtext#1{% \pdfextension literal direct {/Span <</ActualText(foobar)>> BDC}% #1% \pdfextension literal direct {EMC}% } \def\grabinline#1${\actualtext{#1}$} \def\grabdisplay#1$${\actualtext{#1}$$} \everymath{\grabinline} \everydisplay{\grabdisplay}$ a^2 + b^2 = c^2 \$

$$a^2 + b^2 = c^2$$

\bye

I also noticed that you have asked this question before (at least I
think that was you):

https://tex.stackexchange.com/questions/490736/how-insert-pdf-literal-before-and-after-paragraph

Cheers, Henri