Input Control Patterns - Restrictions on Input Controls

0

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-patterns

The 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 ?

reportdev's picture
1226
Joined: Oct 12 2015 - 12:05pm
Last seen: 2 months 4 weeks ago

1 Answer:

0

it works after some trial and error / searching.

https://howtodoinjava.com/regex/java-regex-validate-social-security-numb...

    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.

reportdev's picture
1226
Joined: Oct 12 2015 - 12:05pm
Last seen: 2 months 4 weeks ago
Feedback