Tweet · 18 Apr 2019, 14:26 UTC

Replying to @gro_tsen and @johncarlosbaez

You shouldn’t need to reach for Perl, you can use the parity directly in the regular expression, no? Getting escaping right will depend on the context in which the regex is used (might need to double-\) but a global replace of \$\$?(.*?)\$\$? with \($1\) might be a start?