当前位置:网站首页>Regular matching numbers, English and English symbols
Regular matching numbers, English and English symbols
2022-06-28 13:45:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Search the Internet for many regular verification methods , But there is no ideal solution . I summed up , There are two ways to solve this problem .
1、 Each character is verified by a circular string , This method is simple without introduction
2、 adopt ASCII Match the number of matches to determine whether they match ( Don't cycle )
The second way is to perform regular verification without loop to achieve the detection effect , This is also the reason why bloggers have not found a suitable method ( The total sensory cycle is unnecessary ).
new RegExp("[\x20-\x7E]{"+str.length+"}")By numbers , English and English symbols ASCII Code range for string validation , And add the number of times it appears , If there is no match between the length of the string and the number of times, it is proved that there are characters outside the range . If you simply take ASCII Code range for verification , Only characters that appear in the range will be returned true, It doesn't directly tell us whether there are characters outside the range .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/150618.html Link to the original text :https://javaforall.cn
边栏推荐
- Hang Seng Electronics: lightdb, a financial distributed database, has passed a number of evaluations by China Academy of communications technology
- Mobile web training day-2
- 《畅玩NAS》家庭 NAS 服务器搭建方案「建议收藏」
- Electronic components distribution 1billion Club [easy to understand]
- plt. Usage of savefig() and save path
- PHP gets the number of digits and replaces it with the specified mantissa
- PCB understand Wang, are you? I am not
- How to solve the data inconsistency between redis and MySQL?
- 锐捷交换机配置ssh password登录命令[通俗易懂]
- 设计人工智能产品:技术可能性、用户合意性、商业可行性
猜你喜欢
随机推荐
Hubble database x a joint-stock commercial bank: upgrade the number management system of Guanzi, so that every RMB has an "ID card"
How to open an account on the flush? Is it safe
Inftnews | technology giants accelerate their march into Web3 and metauniverse
ThreadLocal的简单理解
Yii2 connects to websocket service to realize that the server actively pushes messages to the client
设计人工智能产品:技术可能性、用户合意性、商业可行性
Nature子刊 | 绘制植物叶际菌群互作图谱以建立基因型表型关系
Visual design tutorial of word cloud
(原创)【MAUI】一步一步实现“悬浮操作按钮”(FAB,Floating Action Button)
决策树预测红酒品质
《畅玩NAS》家庭 NAS 服务器搭建方案「建议收藏」
[understanding of opportunity -32]: Guiguzi - Dui [x ī] Five attitudes towards danger and problems
First knowledge of exception
thinkphp6 多级控制器目录访问解决方法
Kubernetes 深入理解Kubernetes(二) 声明组织对象
NPOI导出Excel并下载到客户端
2.01 backpack problem
Embedded design and development project - liquid level detection and alarm system
3、项目的整体UI架构
Zhongang mining focuses on the fluorine chemical industry and lays out the new energy industry chain









