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
Eager-2-LearnEager-2-Learn 

Regex

Hi,

 

Is there a way to use REGEX to check a field to make sure it follows a specifi format with a delimiter?

 

The field will have alfa-numeric values but they must be 4 digits long with a comma seperation and no spaces.  There is no specific on how many groups of these alfa-numerics are allowed.  

 

These would be valid:

1xi4,GX19,Nn92

ZZZ1,8939,YXKE,791W

 

These would not be valid:

1x49d,GX1,Nn92

,1xi4,GX19,Nn92

1xi4,GX19,Nn92,

1xi4,GX19, Nn92


Best Answer chosen by Admin (Salesforce Developers) 
Eager-2-LearnEager-2-Learn

I had the comma in the wrong spot!

 

It should be inside the lef pareth:

 

 NOT(REGEX(Facets_Grp_s__c, "[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9](,[a-​zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9]){0,10}")​)

 

If anyone has a shorter version I would life to have it.  I tried the \W but Salesforce didn't like it!

All Answers

Eager-2-LearnEager-2-Learn

I started this but it doesn't seem to completely work as I described in my prior post above! :(

 

NOT(REGEX(Facets_Grp_s__c, "[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9],([a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9]){0,10}"))

 

If I put in 039H,393Y I can save

if I put in 039h, 393Y I cannot save

 

Those are good and working as expected

However, ....

 

if I put in nothing I cannot save (I need to save the record if the field is blank)

If I put in 039H I cannot save ( should be able to save with only one entry)

 

Please help!

 

Eager-2-LearnEager-2-Learn

I had the comma in the wrong spot!

 

It should be inside the lef pareth:

 

 NOT(REGEX(Facets_Grp_s__c, "[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9](,[a-​zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9]){0,10}")​)

 

If anyone has a shorter version I would life to have it.  I tried the \W but Salesforce didn't like it!

This was selected as the best answer
visha Bhardwajvisha Bhardwaj
actually, I found genuine and useful information on this website. thanks for sharing your valuable knowledge. regards PMHELPLINE (https://www.pmhelpline.com/)
mar cutmar cut
Cheap laptops are much better than they used to be, but it can be difficult to choose the right one. Get the Best Budget Laptops 2022 with the best price here. https://bestlaptopreviews.co.in/best-budget-laptops/
Mathew ListMathew List
The best surfers are forming famous competitions in beautiful locations for such water events. Watching this exciting sport is interesting, however, it is not so easy to make rates, because the factors affecting the victory of the favorite are quite a lot https://oddsdigger.com/nz/surfing. It should be first learned to determine what exactly will contribute to the victory of your athlete.
hsd asawhsd asaw
Can you share the complete script code of this program? I want to test it for my gaming app of dragon city (https://apkmortgage.com/dragon-city-mod-apk/) app.
Rimpa BanikRimpa Banik
West Bengal Police Recruitment for Constable & SI: Download Advertisement Notification at https://pscwb.org.in/wb-police-recruitment-si-constable-vacancy/
Bongs EduBongs Edu
that's true I realize this before  (https://bongsedu,com)