Is there a way to validate a Salesforce ID, maybe using RegEx? They are normally 15 chars or 18 chars but do they follow a pattern that we can use to check that it's a valid id.
There are two levels of validating salesforce id:
[a-zA-Z0-9]{15}|[a-zA-Z0-9]{18}
Code examples provided in comments: