/** * Tells whether or not the given regular expression is a valid pattern (for {@code Generex}). * * @param regex the regular expression that will be validated * @return {@code true} if the regular expression is valid, {@code false} otherwise * @throws NullPointerException if the given regular expression is {@code null} */ public static boolean isValidPattern(String regex) { try { createRegExp(regex); return true; } catch (IllegalArgumentException ignore) { // NOPMD - Not valid. } catch (StackOverflowError ignore) { // NOPMD - Possibly valid but stack not big enough to handle it. } return false; }
/** * Tells whether or not the given regular expression is a valid pattern (for {@code Generex}). * * @param regex * the regular expression that will be validated * @return {@code true} if the regular expression is valid, {@code false} otherwise * @throws NullPointerException * if the given regular expression is {@code null} */ public static boolean isValidPattern(String regex) { try { createRegExp(regex); return true; } catch (IllegalArgumentException ignore) { // NOPMD - Not valid. } catch (StackOverflowError ignore) { // NOPMD - Possibly valid but stack not big enough to handle it. } return false; }
public Generex(String regex, Random random) { regex=requote(regex); regExp = createRegExp(regex); automaton = regExp.toAutomaton(); this.random = random; }
public Generex(String regex, Random random) { regex = requote(regex); regExp = createRegExp(regex); automaton = regExp.toAutomaton(); this.random = random; }