Skip to content

markwhitaker/RegexToolbox.Java

Repository files navigation

icon

RegexToolbox.Java Build and test Download from JitPack

Regular expression tools for Java developers.

RegexBuilder

RegexBuilder is a class for building regular expressions in a more human-readable way using a fluent API. It offers a number of benefits over using raw regex syntax in strings:

  • No knowledge of regular expression syntax is required: just use simple, intuitively-named classes and methods.
  • Code is easier to read, understand and maintain.
  • Code is safer and far less prone to regular expression syntax errors and programmer errors.

Here's an example:

Pattern regex = new RegexBuilder()
    .text("Hello")
    .whitespace(RegexQuantifier.oneOrMore())
    .text("world!")
    .buildRegex();

But that's just a taste of what RegexBuilder does: for full API documentation, head over to the project wiki.

Breaking change in 2.0: Logging removed

The logging API added in version 1.3 wasn't adding as much value as intended and incurred an additional maintenance overhead. It is removed in version 2.0.

Usage (Gradle)

RegexToolbox.Java is hosted on JitPack. Replace x.y.z with the latest version (shown in the JitPack badge at the top of this page).

repositories {
    ...
    maven { url 'https://jitpack.io' }
}

implementation 'com.github.markwhitaker:RegexToolbox.Java:x.y.z'

Also for Java developers

icon MimeTypes.Java: MIME type constants for your Java projects

RegexToolbox for other languages

icon RegexToolbox for Kotlin

icon RegexToolbox for .NET

icon RegexToolbox for JavaScript


RegexToolbox: Now you can be a hero without knowing regular expressions.