Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30274
    Patrick C
    Participant

    EmEditor’s highlighter would allow full customisation by using regex matches.
    → Emphasis on would.

    Example 1: Javascript template string literal.
    Regex: ‵.*?‵
    → Strings and comments in the regex result in the regex being ignored 😧
    Example 1

    Example 2: Same as example 1, but with custom double quoted string detection.
    Template string regex: ‵.*?‵
    Double quoted string regex: “.*?”
    → Same flaw 😞
    Example 2

    Example 3: Same as example 2, but with custom string and comment detection.
    Template string regex: ‵.*?‵
    Double quoted string regex: “.*?”
    Line comment regex: //.*$
    → Same flaw 😭
    Example 3

    Is this intended?
    Did I miss a setting in the options?
    How could I achieve the desired effect?

    #30280
    Yutaka Emura
    Keymaster

    This is currently by design, as ” and // are given higher priority than other general highlights.

    #30291
    Patrick C
    Participant

    Hello Yutaka,

    Thank you for your feedback so far!

    This is currently by design, as ” and // are given higher priority than other general highlights.

    Perhaps you missed my last example, where " and // are disabled and only regex highlighting is used (guess I posted too many examples).

    Motivated by your response, I’ve now looked into this a bit deeper and narrowed down the cause.
    The problem arises when a regex matches multiple characters, i.e. when using * or + or {3,} etc.

    The following is an updated example, putting aside " and //:
    Two regex matches are active, all string and comment matches are disabled.

    ″.*?″ regex match 1/2
    %%.*$ regex match 2/2

    Same problem:
    EmEditor stops matching ″.*?″ as soon as it encounters %%.*$, even though the regex match for ″.*?″ has not yet been completed.

    Update example.

    Would this be difficult to fix?
    Because it is a serious limitation. One could write much more accurate highlighters than what is currently possible.

    Your help is greatly appreciated.
    Many thanks!
    Patrick

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.