当前位置:网站首页>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
边栏推荐
- Latest summary! 30 provinces announce 2022 college entrance examination scores
- 程序员坐牢了,会被安排去写代码吗?
- PCB understand Wang, are you? I am not
- China Database Technology Conference (DTCC) specially invited experts from Kelan sundb database to share
- Oracle 云基础设施扩展分布式云服务,为组织提供更高的灵活性和可控性
- Simple understanding of ThreadLocal
- (original) [Maui] realize "floating action button" step by step
- Websocket automatically disconnects in 1 minute
- 单元测试 CI/CD
- G : 最大流问题
猜你喜欢

接雨水系列问题

How fragrant! The most complete list of common shortcut keys for pychar!

thinkphp6 多级控制器目录访问解决方法

895. longest ascending subsequence

如何设计数据可视化平台

2.01 backpack problem

Jupyter notebook中添加虚拟环境

Solution to directory access of thinkphp6 multi-level controller

How vscade sets auto save code

Elastic box auto wrap demo
随机推荐
Simple understanding of ThreadLocal
PostgreSQL surpasses MySQL
Embedded design and development project - liquid level detection and alarm system
N皇后问题
3、项目的整体UI架构
Vscode shortcut key
做一个墨水屏电子钟,炫酷!
CodeBlocks MinGW installation configuration problem
En parlant d'exception - que se passe - t - il lorsque l'exception est lancée?
腾讯云国际云服务器登录之后没有网络,如何排查?
MySQL多表联合查询
How vscade sets auto save code
How to open an account on the flush? Is it safe
How to set auto format after saving code in vscade
Action interprets value. The chairman of chenglian Youpin Han attended the Guangdong Yingde flood fighting donation public welfare event
你的代码会说话吗?(上)
How to solve the problem that the computer wireless network does not display the network list
China Database Technology Conference (DTCC) specially invited experts from Kelan sundb database to share
PHP crawls web pages for specific information
How to solve the data inconsistency between redis and MySQL?