User:Rongzhou/Nvim Regex: Difference between revisions

From Wikibase
Jump to navigation Jump to search
 
Line 16: Line 16:


<syntaxhighlight lang="text" copy>
<syntaxhighlight lang="text" copy>
:%s/\\(\(.\{-}\)\\)/$\1$/g
:%s/\(\\(\(.\{-}\)\\)\)\|\(\\\[\(\_.\{-}\)\\\]\)/\=submatch(1) != '' ? '$'.submatch(2).'$' : '$$'.submatch(4).'$$'/g
:%s/\\\[\(.\{-}\)\\\]/$$\1$$/g
</syntaxhighlight>
</syntaxhighlight>


<syntaxhighlight lang="text" copy>
<syntaxhighlight lang="text" copy>
:%s/\$\$\(.\{-}\)\$\$/\\[\1\\]/g
:%s/\$\$\(\_.\{-}\)\$\$\|\$\(.\{-}\)\$/\=submatch(0) =~ '^\$\$' ? '\['.submatch(1).'\]' : '\('.submatch(2).'\)'/g
:%s/\$\(.\{-}\)\$/\\\(\1\\\)/g
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 07:06, 23 September 2026

Markdown /md

Text <> list

:%s#^#- #
:%s#^- ##

Katex

\[ \( <> $$ $ separator change:

:%s/\(\\(\(.\{-}\)\\)\)\|\(\\\[\(\_.\{-}\)\\\]\)/\=submatch(1) != '' ? '$'.submatch(2).'$' : '$$'.submatch(4).'$$'/g
:%s/\$\$\(\_.\{-}\)\$\$\|\$\(.\{-}\)\$/\=submatch(0) =~ '^\$\$' ? '\['.submatch(1).'\]' : '\('.submatch(2).'\)'/g