Check whether a string has the 11-digit Chinese mobile-number format.
The pattern requires a leading 1 followed by ten digits. It does not verify assigned prefixes, ownership, reachability, or international formats.
1
Usage:
import { isCNMobileNumber } from "mazey";const ret1 = isCNMobileNumber("13800138000");const ret2 = isCNMobileNumber("1380013800");const ret3 = isCNMobileNumber("138001380000");const ret4 = isCNMobileNumber("1380013800a");console.log(ret1, ret2, ret3, ret4); Copy
import { isCNMobileNumber } from "mazey";const ret1 = isCNMobileNumber("13800138000");const ret2 = isCNMobileNumber("1380013800");const ret3 = isCNMobileNumber("138001380000");const ret4 = isCNMobileNumber("1380013800a");console.log(ret1, ret2, ret3, ret4);
Output:
true false false false Copy
true false false false
The string to check.
Whether the string matches the Chinese mobile-number format.
Check whether a string has the 11-digit Chinese mobile-number format.
The pattern requires a leading
1followed by ten digits. It does not verify assigned prefixes, ownership, reachability, or international formats.Usage:
Output: