验证 Salesforce ID [英] Validating a Salesforce Id

查看:44
本文介绍了验证 Salesforce ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 RegEx 验证 Salesforce ID?它们通常是 15 个字符或 18 个字符,但它们是否遵循我们可以用来检查它是否是有效 ID 的模式.

解决方案

验证 salesforce id 有两个级别:

  1. 使用正则表达式检查格式[a-zA-Z0-9]{15}|[a-zA-Z0-9]{18}
  2. 对于 18 个字符的 ID,您可以查看
  3. Go 中的示例
  4. 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:

    1. check format using regular expression [a-zA-Z0-9]{15}|[a-zA-Z0-9]{18}
    2. for 18-characted ids you can check the the 3-character checksum:

    Code samples provided in comments:

    这篇关于验证 Salesforce ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆