小编DRW*_*W02的帖子

如何编写只接受字符串的正则表达式

我试图理解正则表达式,我觉得理解它真的很混乱.我需要知道如何编写一个正常的表达式,它只匹配字符串,NO NUMBERS,NO SPECIAL CHARACTERS,只是来自A - Z的字母.我不得不说我尝试过使用\[a-z]\但是它没有按照我想要的方式工作.这些是我想要的一些结果:

pe<.?ter -----> should return false
ale8 ---------> should return false
?ramon -------> should return false
tho<>?mass----> should return false

peter -----> should return true
alex ------> should return true
ramon -----> should return true
thomas ----> should return true
Run Code Online (Sandbox Code Playgroud)

javascript regex

-8
推荐指数
1
解决办法
198
查看次数

标签 统计

javascript ×1

regex ×1