Skip to content
大纲

不能包含字母

验证字符串,不能包含 字母

语法

js
import { noLetterReg } from 'warbler-js';
const result = noLetterReg(value);

参数

  • value (String) : 待验证字符串。

返回值

Boolean : 是否通过验证,true 通过验证, false 没有通过验证。

源码

js
const noLetterReg = (value) => {
  const reg = /^[^A-Za-z]*$/;
  return reg.test(value);
};

例子

js
import { noLetterReg } from 'warbler-js';
const result1 = noLetterReg('一尾流莺1!@#');
const result2 = noLetterReg('a');

console.log(result1); // true
console.log(result2); // false

添加版本

1.2.0

Released under the MIT License.