/Jregex

library for easily working with regular expressions and text colors in the terminal

Primary LanguageJava

Jregex - A simple library for easily working with regular expressions and text colors in the terminal

Examples

The library allows you to work with regular expressions simply and clearly. Jregex example:

public class RegularExpressionsTest {
    public static void main(String[] args) {
        String pattern = new JRegex()
                .digit().times(5)
                .just("-")
                .digit().times(4).optional()
                .build();

        System.out.println(pattern);  // Output: \d{5}(-\d{4})?
    }
}

Coloring

The library also allows you to work with text color in the console. Usage example:

public class AnsiColoringTest {
    public static void main(String[] args){
        System.out.println(ansi.fgRed("Hello") + " " + ansi.fgGreen("World"));
    }

}