Skip to content

New Kotlin DSL-style syntax and improved quantifiers

Compare
Choose a tag to compare
@markwhitaker markwhitaker released this 11 Sep 21:43
96a30fc

This release adds a type-safe builder DSL-style syntax so you can now replace this:

val regex = RegexBuilder()
    .startGroup()
    .letter()
    .digit()
    .buildRegex() // ERROR! forgot to close group

with this:

val regex = regex {
    group {
        letter()
        digit()
    } // Yay! Can't forget to close a group
} // Yay! No need to call buildRegex()

It also makes Quantifiers a bit cleaner. Instead of this:

    text(zeroOrMore())

You now do this:

    text(ZeroOrMore) // Initial capital (bacause it's now a class), no brackets