创建一个对应美国和加拿大电话号码的正则表达式的例子.
常规表达式的一个例子是: - `^\D?(\d{3})\D?\D?(\d{3})\D?\d{4})$` 这种常规表达式分为: - `^`表示字符串的开始. - `\D?`表示零或一个非数字字符. 这用于解释任何格式字符,如 `(`, `) `, 或 `-`. - `(\d{3}) `匹配一个代表区域码的三位数组. - 另一个格式的形式使用另一个格式的形式. - `(\d{3}`) 匹配一个代表办公室的三位数组. - `\D?`表示另一个中心码. - `\D?`用于描述4位数组的数字. - `\d}表示一个代表用户最后一段字符的数字. - `\d\$\d\\d\\\d\\d\\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d