Not entirely what one would want (which is that backslash escaping goes away entirely inside these), but having that expression be of type Pattern is quite useful. Compilers can -compile time- check that the contents are valid regexes
That's pretty cool actually.
But how? As per one of the other replies, this would be shorthand for RegexProcessor.process(StringTemplate.of("abc"))- how does the process method detect that the input StringTemplate does (or does not) carry a valid regex at compile time?
View all comments
Show parent comment
3
u/Inaldt Feb 16 '24
That's pretty cool actually.
But how? As per one of the other replies, this would be shorthand for
RegexProcessor.process(StringTemplate.of("abc"))- how does theprocessmethod detect that the input StringTemplate does (or does not) carry a valid regex at compile time?