reportdev Posted September 19, 2017 Posted September 19, 2017 I have been trying to put some validations on my input controls on reports server using 6.4.I have used the same pattern mentioned in the referenced question, but still no luck . http://community.jaspersoft.com/questions/539304/input-control-patternsThe input control page displays an error message "This field does not match the required pattern".I have also tried using the Java regex patterns, but still it does not accept the Strings in the same pattern.I'm I missing something here ?
Solution reportdev Posted September 19, 2017 Author Solution Posted September 19, 2017 it works after some trial and error / searching.https://howtodoinjava.com/regex/java-regex-validate-social-security-numbers-ssn/ public static void main(String[] args) { String s = "123-45-6789"; String regex = "^(?!000|666)[0-8][0-9]{2}-(?!00)[0-9]{2}-(?!0000)[0-9]{4}$"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(s); System.out.println(matcher.matches()); }Same pattern when used on the jasper input control, disallows any other patterns.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now