Makan
Makan

Reputation: 2736

Regex to Ignore comments in Latex

I'm using a spell checker to improve my Latex document. I'm using vscode, and the Spell Right extension does the job. I want to have it ignore the single-line comments, so I set the following value:

"spellright.ignoreRegExps": [
    "%.*"
]

in the settings, and I expect the regex to grasp a line from the '%' forward to the end of the line. But the Spell Right extension considers the %.* Malformed. Is it really?

When I try this regex at regex101 website, it selects what I expect.

Is there another correct way that I'm missing?

Upvotes: 1

Views: 625

Answers (1)

Valdi_Bo
Valdi_Bo

Reputation: 30971

I found in the Web some examples of ignoreRegExps, where:

  • the content of regex is surrounded with slashes,
  • after the final slash there can be regex options (in your case probably not needed).

So maybe you should change your regex to:

"/%.*/"

Upvotes: 2

Related Questions