Closed ousia closed 1 month ago
Of course, already done @PerilousBooklet.
I wonder whether \\(?:sub)*section
would be also an option (also \\(?:sub)*paragraph
.
Yes I didn't notice, you can do \\(?:sub)*section
, but for the paragraph \\(?:sub)?paragraph
is better (if there are only paragraph and subparagraph).
If there are more sub paragraphs you can use, for example, \\(?:sub){0,2}paragraph
, where the 2 is the max number of sub
occurrences.
Yes I didn't notice, you can do
\\(?:sub)*section
, but for the paragraph\\(?:sub)?paragraph
is better (if there are only paragraph and subparagraph).
Ok, I will submit a new PR, since this would have three commits instead of one.
If there are more sub paragraphs you can use, for example,
\\(?:sub){0,2}paragraph
, where the 2 is the max number ofsub
occurrences.
I know, but unless this saves noticeable computing, I think that *
(or +
when a single occurrence at least is required) is also more readable.
Many thanks for your help.
Wait why a new PR? It's fine if it has a couple commits.
Sorry, too fast on my side.
Sorry, testing the changes on my computer, no regex works in commands.
Do I need an addon or special plugin?
I use this to test regex: https://regex101.com/ . Also, what do you mean by "no regex work in commands" ?
By no regex works in commands I mean that I get \part
highlighted different from \whatever
, but \subsection
is colored as \whatever
(not as \part
).
I was in the way to have something like \\use(package|module)
.
I tested everything \subject
and it didn’t have special highlighting (as keyword).
By the way, if you use regex you must use regex
instead of pattern
.
pattern
is for lua patterns, not regex patterns.
You can use a
So instead you would do
non-capturing group
to avoid repeating the subsub... strings, like this\\(?:sub)+ject
and\\(?:sub)+section
.