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
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
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
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.
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?
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
Thanks Jeff. I got it work with your update.
Good to hear, Steve! Thank you for confirming.
Best regards,
Jeff
Here's a great tool for figuring out regular expressions
https://regexr.com/
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
Hi Steve, yeah, I've never seen those elements before. So ([A-Z]?) doesn't work for capturing a single upper case alphabetic character?
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.
Yuck