We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HS_FLAG_MULTILINE does not seem to have any impact in java API.
public class Validator { private static final EnumSet<ExpressionFlag> flags = EnumSet.of(ExpressionFlag.CASELESS, ExpressionFlag.PREFILTER, ExpressionFlag.MULTILINE); private static boolean isRegexValidHyperscan(String regex) { Expression expression = new Expression(regex, flags); Expression.ValidationResult result = expression.validate(); if (result.getErrorMessage() != null) System.out.println(result.getErrorMessage()); return result.isValid(); } private static boolean isRegexValidJava(String regex) { try { Pattern.compile(regex, Pattern.MULTILINE | Pattern.CASE_INSENSITIVE); return true; } catch (PatternSyntaxException e) { e.printStackTrace(); return false; } } public static void main(String[] args) throws Exception { String regex = "\\d{13}^[A-Z]{1}"; boolean regexValidHyperscan = isRegexValidHyperscan(regex); System.out.println(regex + " valid by hyperscan: " + regexValidHyperscan); boolean regexValidJava = isRegexValidJava(regex); System.out.println(regex + " valid by java: " + regexValidJava); } }
produces
Embedded start anchors not supported. \d{13}^[A-Z]{1} valid by hyperscan: false \d{13}^[A-Z]{1} valid by java: true
@gliwka from what I read it should from the doc it should ve a valid regex, right?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
HS_FLAG_MULTILINE does not seem to have any impact in java API.
produces
@gliwka from what I read it should from the doc it should ve a valid regex, right?
The text was updated successfully, but these errors were encountered: