Jump to content

Input Control Patterns - Restrictions on Input Controls


Go to solution Solved by reportdev,

Recommended Posts

Posted

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 ?

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Solution
Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...