Skip to content

A Dart Regex helper to give an experience similar to Swift's RegexBuilder

License

Notifications You must be signed in to change notification settings

Hari-07/dart-regex

Repository files navigation

A Type-safe DSL for building regular expressions in Dart using composable building blocks.

Usage

final DartRegex emailPatternDSL = DartRegex([
  CaptureGroup(
    OneOrMore(Word()),
  ),
  CharacterSet('@'),
  CaptureGroup(
    OneOrMore(
      AtomGroup(
        [Word(), CharacterSet('.'), Word()],
      ),
    ),
  ),
]);

Available Components

Atoms

  • Word()
  • Digit()
  • Whitespace()
  • AnyCharacter()
  • CharacterSet()
  • AtomGroup()

Quantifiers

  • ZeroOrMore()
  • OneOrMore()
  • ZeroOrOne()
  • Exactly()
  • Range()

Groups

  • CaptureGroup()

Additional information

Feel free to file issues, this is under development, so expect breaking changes till 1.0.0

About

A Dart Regex helper to give an experience similar to Swift's RegexBuilder

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages