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
PannarPannar 

Validation Rule - to check western characters?

Dear all,
 
Is there way to create the validation rule on the particula custom field Name(Text(255) under Opportunity object.
There should be a restriction in that particular field that it should only allow western characters. Is it possible?
 
please respond.
regards
pannar
JakesterJakester
I think you could use RegEx for this - something like

Code:
regex(Name, "[a-zA-Z0-9]{255}")

 

would allow any upper case or lower case a-z characters or numbers up to 255 digits long. I'm not sure if it would allow spaces. You can google RegEx() for lots of examples.
PannarPannar
Thanks.
 
I've tried this code:-
 
Code:
if( 
REGEX(Name, "[a-zA-ZÀ-ÿ]"),
true, 
false 
)

 but it doesn't work. Its allowing me to enter any characters and saved the account record! :-(
 
I have to restrict the user to enter ONLY Western characters on this field Name. possible?

 
PannarPannar
Oops! it thrown the error for ONLY ONE chacter which was entered between a-z or A-Z.
 
but i have to check the complete value which contains mulitple chars. ?
PannarPannar
Sorry, i missed * at the end of pattern. it worked.
Code:
REGEX(Name, "[a-zA-Z]*"), 

 
Do i have to pass anything else for non-western chars checking?
PannarPannar

Could you please tell me the range of Western characters which can be passed in REGEX. If i get the range, then i am done with my requirement.

thanks a lot

JakesterJakester
I'm confused - you never tried the code that I wrote - was that because it didn't work? If so, what didn't work about it?
PannarPannar

Jakester,

I've tried your code. it worked perfectly. It is not allowing any english characters and numbers . thats fine. but it allows chinese characters which are not coming under Western characters right? So, i need to check ONLY western characters RANGE so that anything other than western characters would not be allowed. understood?

Please guide me.

JakesterJakester

Hi Pannar,

You're still not making much sense - you say that "it worked perfectly," but you also say "it is not allowing any english characters and numbers", but of course the whole point of the code is that it allows only characters and numbers.

I don't have any experience with other languages and RegEx, so I think your best bet is to clarify what the issue is and see if someone else might help. Here's a resource on RegEx that you might find interesting.

PannarPannar
Sorry, i think i made you confused. :-(
 
Just wanted to restrict the Non-Western characters from being entered. That's why i asked that is there any range of Western characters put inside the REGEX which will be able to prevent the users from entering non-western chars.
 
Still finding the range of Western chars! :-(