contextual

simple and typesafe interpolated strings, checked at compile-time

Package Information

SBT

"com.propensive" %% "contextual-examples" % "1.0.0"

License

Apache 2.0

Source code

Defined contexts

None

Predefined substitution types

None

Regular Expression (regex"")

Features

  • Checks that regular expressions compile
  • Does not support substitutions

Examples

> import contextual.examples.regex._
> regex"""^[0-9]{1,13}(\.[0-9]*)?$$"""
res: java.util.regex.Pattern = ^[0-9]{1,13}(\.[0-9]*)?$
> import contextual.examples.regex._
> regex"""^\(?([0-9]{3})\)?[-.\s]?([0-9]{3})[-.\s]?([0-9]{4})$$"""
res: java.util.regex.Pattern = ^\(?([0-9]{3})\)?[-.\s]?([0-9]{3})[-.\s]?([0-9]{4})$

References