I have come up with the following regex:
(.*\\\\\\\\documentclass.*)|(.*\\\\\\\\documentstyle.*)
This regex will be used to determine whether a document contains a \\documentclass or a \\documentstyle tag.
I would like to avoid matching a string starting with %
such as this:
% To use with LaTeX, use \\documentstyle[psfig,...]{...}
How may I include a negative lookbehind of some sort to avoid matching to this string?
Anchor to the start of the line with ^
(with multiline mode), negative lookahead for %
, and then alternate:
(?m)^(?!%)(?:.*\\document(?:class|style).*)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.