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
Abhishek Prasad 8Abhishek Prasad 8 

We want to restrict users from entering any special characters other than Carriage Return(CR),comma, space. This is done on a Custom VF page. We are trying to achieve this using validation rules/Regex. please help,

vishnu Rvishnu R
hi prasad ,

try this regex ^[a-zA-Z0-9,.!? ]*$

hope this helps you..
 Thanks
Vishnu R
Abhishek Prasad 8Abhishek Prasad 8
@ Vishnu
It didnt work. I tried:
REGEX([a-zA-Z0-9,.!? ]*$)

Error: Syntax error. Missing '='
vishnu Rvishnu R
hi,

NOT(REGEX( your field name ,"^[a-zA-Z0-9,.!? ]*$"))

hope this helps you

thanks 
Vishnu R
vishnu Rvishnu R
hi

you are using in a vf page..right? i thought it in a validation
so use the same regex like this in script..and place the script in vf page

<script >
        function show()
        {
var phn=document.getElementById("{!$Component.pg.fm.pgb.pbs.one}");
var pattern=^[a-zA-Z0-9,.!? ]*$;
if(!pattern.test(phn.value))
            {
                alert("some thing you want to see");
                phn.focus();
                return false;
            }
}
</script>

hope this helps you..

thanks 
Vishnu R