Skip to content

A small library that makes it easy to create regex patterns, without having to know every regex character sequence, eliminating the need for regex cheat-sheets.

License

Notifications You must be signed in to change notification settings

PhilipJonasFranz/regex.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

regex.io version

How to use

Include the standalone .jar in your project folder and you are ready to go. With

String regex = new Regex().anyDigit().build()

you can create a regex via the builder pattern. By calling build() on the regex object, you can convert the object to a string that represents this regex operation. Using string.matches(regex) you can match any string against the created pattern.

If you want additional safety when creating patterns, turn on runtime assertions, to make sure the passed arguments are valid.

Example

For example, this regex configuration

String pattern = new Regex()
 .anyCharacter()
 .character('c')
 .whitespace()
  .or(
   new Regex()
    .nOrMore(new Regex()
     .anyDigit(),
     3
    ),
   new Regex()
   .character('G')
  )
.build();

will result in the regex .c\s((\d){3,}|G), that will match for example %c G, but not %c 23.

License and Copyright

© Philip Jonas Franz

Licensed under Apache License 2.0.

About

A small library that makes it easy to create regex patterns, without having to know every regex character sequence, eliminating the need for regex cheat-sheets.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages