I have some tex files with \section{text}
and \subsection{text}
, etc. And I want to convert them to # text
and ## text
in markdown files using regular expressions in Notepad++. How can I achieve that?
Open the replace window with Ctrl + H. Check the radio button "Regular Expression" and search for:
\\section\{([^}]*)}
And replace with:
# \1
For subsections:
\\subsection\{([^}]*)}
## \1
What we're doing:
\\
is an escaped backslash matching the litteral backslash of your expression{
needs to be escaped as well otherwise it would be recognized as quantifier, hence \{
([^}]*)
is a group made of 0 or more characters that are NOT }
\1
is a reference to the first and only group of our regular expression