Search in sources :

Example 1 with Regex

use of priv.bajdcc.util.lexer.regex.Regex in project jMiniLang by bajdcc.

the class TestRegex method main.

public static void main(String[] args) {
    try {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        Regex ra = new Regex(str, true);
        String context = scanner.nextLine();
        String match = ra.match(context);
        if (match == null) {
            System.err.println("failed");
        } else {
            System.out.println(match);
        }
        scanner.close();
    } catch (RegexException e) {
        System.err.println(e.getPosition() + "," + e.getMessage());
        e.printStackTrace();
    }
}
Also used : Scanner(java.util.Scanner) Regex(priv.bajdcc.util.lexer.regex.Regex) RegexException(priv.bajdcc.util.lexer.error.RegexException)

Aggregations

Scanner (java.util.Scanner)1 RegexException (priv.bajdcc.util.lexer.error.RegexException)1 Regex (priv.bajdcc.util.lexer.regex.Regex)1