Compiles the specified expression into a Regex.
Compiles the specified expression into a Regex.
Compiles the specified expression into a Regex.
This is useful when you're only interested in a specific group of each match, and that group is of a type that already has a GroupDecoder - typically, a primitive type. For example:
// An example match will be [123], with the first equal to 123. That's the bit we want to extract // as an int. compiler.compile[Int]("""\[(\d+)\]""", 1)
A MatchDecoder[A] will be generated by calling
MatchDecoder.fromGroup with the specified group
value.
Unsafe version of compile
.
Unsafe version of compile
.
Type class for types that can be compiled to instances of Regex.
While regular expression literals are usually the preferred way of creating instances of Regex, they don't fit all possible situations - one might imagine, for example, a scenario where a regular expression is created dynamically before being compiled.
Compiler is provided for these cases where literals are not an option. The preferred way of using it is to make sure the corresponding syntax is in scope and use the
asRegex
method: