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?

Hi,
 
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 
RickyGRickyG
Pannar -

Validation rules can use the REGEX function, and this page has an example of using regular expressions to check to see if only western characters are in a string.  Haven't tested it, but think it should work.

Of course, validations are applied on a record at save time, not on a field, but the validation can check the values in a field.

Hope this helps.
PannarPannar
Thanks Rick.
 
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
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
Ricky,

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

BrianWXBrianWX

I work on the same exercise to force the Account Name to be in English/Western characters only.  After researching from various sites and this, I finally derived a workable regex pattern for this purpose.  Hope this will help the dev out there and to get some feedbacks on this, if any.

 

NOT(REGEX(Name, "^[a-zA-ZÀ-ÿ0-9-/ \\p{Punct}]*$"))

 

Cheers,

Brian