Jump to content

Regex allows whitespace but shouldn't


Dan Munns
 Share

Recommended Posts

Hi all,

I have a field in an IC form that should limit the number of digits to 6 and return an error if anything else is entered:

^\d{6}$

However if the user adds a space to the end of the numbers then it is still allowed. I have tried this:

^[0-9]{6}$

which should be the same but explicitly stating the numbers 0-9 and still have the same issue. 

Both above regex expressions match correctly in other applications and on testing sites by disallowing the data if a space is added to the end of the numbers. Am I missing something here or is this a bug? 

Link to comment
Share on other sites

@Dan Munns this is not an issue in IC (assuming this is an acronym for Intelligent Capture)... is only an issue in PC (previous engine) and in the form designer from what I can see... do you have PC2 enabled in your instance?

Link to comment
Share on other sites

@Victor PC2 was turned off, but if I turn it on there is no difference. 

If I use the new or old admin UI then this is the result whilst editing the PC

image.png.8548ca42aa7728d1d8e81687d26c6333.png

As you can see with many spaces it still passes the expression check. On the actual form on the portal it passes as well. 

Link to comment
Share on other sites

@Dan Munns yeah, I know there is an issue when using the test in the designer ... but he validation works ok (it makes the value invalid if it has spaces) when running the progressive capture... the PC2 one that is...

 

Link to comment
Share on other sites

@Victor one issue I have now is with PC2 enabled one of my captures fails as below:
image.png.683c5f090bb016ff06f755f47141a06f.png

Only happens when dynamic questions are added to the form though (though this question itself is dynamic). Even if I turn off the requirement to have the question answered it still fails in the same way. With PC2 off this question works fine but then the regex question on a different form doesn't work as expected.

Link to comment
Share on other sites

image.png.aeafce547a11e9fb5abc9cd7b32ae2ed.pngimage.png.a82a524fbb860000a86397458fb8bc14.png

@Ehsan so this question shows as not completed when it is completed when clicking 'Next' on the PC. This only happens when PC2 is enabled and when other dynamic questions are added to the form (seems to be these):
image.png.8327ddd580d95a85e62c8c9625282f1e.png

These questions have 3 override flags set:
image.png.ec23bd5b7cfbbe6d46f136eda1bea2ba.pngimage.png.f0dbfd6b0188d69907a38cd0b8a91e4f.pngimage.png.57fd2622f66c5891475f0f249292aa29.png

Change Type in the CGL flag is a simple list with CGL appended to the change type in raw but not shown in display.

If PC2 is disabled then this question works as expected but the regex for a different form fails to work correctly (as per my original post in this thread).

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...