function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rehana Wajahat HussainRehana Wajahat Hussain 

Regex Formula Validation to require [a-z][A-Z][0-9] . , : ; ! / and \?

Hi!

I would love to get some help with this validation rule: 

I want this Comments field to include Special characters:  . , : ? ; % ( ) & # ' " * - _ 
My Validation formula works for all the special characters except \ backslash and hyphen represents the range in order to consider it as the literal value I need to escape it using two back slashes.


AND (
NOT(ISBLANK( Comments )),
NOT(REGEX( Comments , "[a-zA-Z0-9.,:?;%/()&#\'!\"\"\\-_* ]+")),
)
Jayeshkumar ParmarJayeshkumar Parmar

Hi Rehana Wajahat Hussain,


Please refer to the below link  exactly with similar issue.


Kindly modify the code as per your requirement which helps you surpass the above challenge.


Can't escape the backslash with regex? (http://stackoverflow.com/questions/4025482/cant-escape-the-backslash-with-regex)

 

If this helps,please mark it as best answer.