Home > OS >  How can I remove automatically via regex and replace \cite[p. x]{authorbla} tags to have a plain te
How can I remove automatically via regex and replace \cite[p. x]{authorbla} tags to have a plain te

Time:05-22

I want to remove any \cite[p. X]{AuthorY} entry in my latex document to get a plain text document that be put into a translation software or spell and grammar checker.

Can anybody provide me the correct regex?

Example: Input:

... financial losses \cite[p. X]{XXX}. Given the high quality (c.f.~Sect.~\ref{chapterX}), it is the best software to use ...

Desired Output:

... financial losses. Given the high quality, it is the best software to use ...

Thank you!

CodePudding user response:

(\(.*\}\)|\s?\\cite\[.*\]\{\w*\})

It only works if this is the same structure for all!

\s?\\cite\[.*\]\{\w*\}) - this part is for match \cite[p. X]{AuthorY}

(\(.*\}\) for remove (c.f.~Sect.~\ref{chapterX}) or everything with ( somecharacters }) pattern

(Please give me some more example to give you a more precise answer)

  • Related