On Wed, 24 Nov 2021 10:01:50 GMT, Hannes Wallnöfer <hann...@openjdk.org> wrote:

>> I abstracted out the mechanics behind the `CoarseParser` precisely because I 
>> couldn't come up with a simple way to derive `payloadEnd` and `markupStart` 
>> using only groups, be they named or otherwise. My regex fu is not strong 
>> enough. If you could find a way that does not look too ugly and passes the 
>> added `TestLangProperties` test, be my guest.
>
> I think the following regexes with named groups should yield the same results 
> as yours:
> 
>     "^(?<payload>.*)//(?<markup>\\s*@\\s*\\w+.+?)$"
> 
>     "^(?<payload>[ \t]*([#!].*)?)[#!](?<markup>\\s*@\\s*\\w+.+?)$"
> 
> (Note that I didn't try running them through the test, maybe I should have :)

Above regexes do pass the test, but  I just saw (too late) that Jon posted a 
generic (language agnostic) solution below in the main conversation thread, 
which probably makes above solution obsolete.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6397

Reply via email to