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
IanSampsonIanSampson 

Regex for 15 and 18 digit object ID and case tracking ID

Does any one have the Regex to test for:

- ObjectIDs (15 and 18 digit length)

- case tracking IDs?

 

Thanks

Ian

Ankit AroraAnkit Arora

If you want to validate that the Id entered in field is of 15-Digit or 18-Digit or is Alphanumeric then try this validation :

 

IF(LEN(YOUR_FIELD_API) == 15 || LEN(YOUR_FIELD_API) == 18 , IF(NOT(REGEX(YOUR_FIELD_API, '^[a-zA-Z0-9]*$') )  , true , false) , true)

 

Please change "YOUR_FIELD_API" with your field API name.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

IanSampsonIanSampson

Thanks Anit.

 

I also found a fantastic Regex editor/ validator at http://gskinner.com/RegExr/

 

Cheers

Ian

Nand AroraNand Arora
This regex has given me the optimal results so far.
\b[a-z0-9]\w{4}0\w{12}|[a-z0-9]\w{4}0\w{9}\b