You are viewing limited content. For full access, please sign in.

Question

Question

Getting "The value provided failed to satisfy the constraint on the field" when using regular expression

asked on March 2, 2016

I have a text field that allows 11 characters.  The allowed format is "yyyymmdd-nn". 

 

The regular expression I have setup is ... "(20[1-5]\d(0|1)\d[0-3]\d-\d\d)"  (the validation does not have to be exact so I am allowing some invalid dates to simplify the expression).

 

When I try to save this constraint I get the error "The value provided failed to satisfy the constraint on the field". 


First question:  This field is not required so do I have to add something to the regular expression to specify this? 

Assuming I might have to do that I also tried ^(20[1-5]\d(0|1)\d[0-3]\d-\d\d)?$.  But this also resulted in the same message.

 

What am I doing wrong here?

 

0 0

Answer

SELECTED ANSWER
replied on March 2, 2016 Show version history

The parentheses are used in regular expression to indicate match groups, so you don't need those since you're not extracting data, just validating it. (0|1) should be just [01] (a range not a match group). Something like 20[1-5]\d[01]\d[0-3]\d-\d\d

Sorry, i forgot that the Client's constraint uses parentheses as just grouping constructs. The one above would work, but I tweaked it to only allow months up to 12 and days up to 31.

20[1-5]\d(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])-\d\d

Year: 20[1-5]\d - 2010-2059

Month: (0[1-9]|1[0-2]) - 01-12

Day: (0[1-9]|[1-2][0-9]|3[0-1]) - 01-31

One thing this does not account for is the number of days in a month. So 0231 would be allowed.

0 0

Replies

replied on March 2, 2016

Thank you.  That got me past that error but now when I try to save it an error appears that says "One or more entries in the recycle bin have field values that do not satisfy the constraint on the field".  I am a Laserfiche administrator.  Is there a way I can look at everyone's recycle bin and remove the offending documents so I can save this change?  (My recycle bin is empty)

0 0
replied on March 2, 2016

In the Laserfiche Administration Console, you should be able to see the recycle bins for all users.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.