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

Question

Question

Forms Regex Validation Case Sensitive

asked on March 24, 2022 Show version history

Can case sensitivity be used with Regex Validation?

I've tried to use ?i and ?c in Forms 11.x but I just get an Invalid Input in the Regex Validation field

0 0

Answer

SELECTED ANSWER
replied on March 24, 2022

I believe that Forms uses JavaScript regular expressions which, unfortunately, do not support "inline modifier spans" such as (?i). 

Workflow, Quick Fields, and Connector all use .NET regular expressions, which do support inline modifiers.

Sources: 
https://www.regular-expressions.info/modifiers.html
https://doc.laserfiche.com/laserfiche.documentation/en-us/Subsystems/ProcessAutomation/Content/Resources/Regular%20Expressions/Regular-Expressions.htm

2 0
replied on November 9, 2022 Show version history

Greetings,

I was struggling with case sensitivity.  In my scenario, I want to make sure an email address is in our domain (I'm using yourcity.gov as an example below) and don't want to restrict the domain to a given case.  We found that if you add a "/i" at the end it will consider the email address entered without being sensitive to the case.  Example RegEx:

/^[A-Za-z0-9._%+-]+@yourcity\.gov$/i

Using the example above, so long as the domain entered by the user is "yourcity.gov", or "Yourcity.gov", or "YOURCITY.GOV", or "YoUrCiTy.GoV", etc. it will accept the email.  Anything with a different domain will be rejected.

 

 

 

2 0
replied on November 15, 2022

Jeff, I tried this as a regex in a single line field in forms and it didn't work for me. How had you applied it, through JS?

0 0
replied on November 15, 2022

Hi Steve,

I realized looking closely at the RegEx value I provided it was missing a leading "/", likely a copy and paste error on my part.  I edited my message to correct.

Please try it with leading forward slash.  Here's the full value:

 

/^[A-Za-z0-9._%+-]+@yourcity\.gov$/i

 

I am also using a single line field.  I am using Laserfiche Forms Professional Version 10.4.1.254.

Best regards,
Jeff

 

 

1 0
replied on November 15, 2022

Thanks Jeff. I got it work with your update.

0 0
replied on November 15, 2022

Good to hear, Steve!  Thank you for confirming.

 

Best regards,
Jeff

0 0

Replies

replied on March 24, 2022

Here's a great tool for figuring out regular expressions
https://regexr.com/

0 0
replied on March 24, 2022

Hi James, that site doesn't support Case Sensitive either (?i) or (?c)

I can use this in Pattern Matching in Workflow but it doesn't work in Forms Regex Validation

(?i)([abc])

I had tried to use both cases in my regex but I would get an error which I expect may be a limitation of the system

0 0
replied on March 24, 2022

Hi Steve, yeah, I've never seen those elements before.  So ([A-Z]?) doesn't work for capturing a single upper case alphabetic character?

1 0
replied on March 24, 2022 Show version history

I'm required to capture a string of characters in either upper or lower case. The actual regex is quite large and I was wanting to use case sensitive so I wouldn't have to include both cases in my pattern ([abcABC]) but that's what I ended up doing in the end.

0 0
replied on March 24, 2022

Yuck

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

Sign in to reply to this post.