Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basic commands for regular expressions

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you what are the basic regular expression commands. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

We often use regular expressions in our work, so here are some common commands for you.

A brief description of regular characters

"^": ^ matches the start of a line or string, and sometimes the start of the entire document

"$": $matches the end of a line or string

"\ d": match the number

"\ s": match spaces

"*": zero or more

"+": one or more times, at least once

"?": zero or once

"{n}": n times

"{nrecom}": n to m times

"{n,}": n or more times

1-50 digits and are letters or numbers

/ ^ [A-Za-z0-9] {1pm 50} $/

The password is 8-16 digits and is a combination of numbers and letters.

/ ^ (?! [0-9] + $) (?! [a-zA-Z] + $) [0-9A-Za-z] {8jue 16} $/

Mailbox format

/ ^ [\ w / s / [: [\ w] (?: [\ w -] * [\ w])?\) + [\ w] (?: [\ w -] * [\ w])? $/

Cell-phone number

/ ^ 1 [345789]\ d {9} $/

Containing Chinese, English and numbers

/ ^ [a-zA-Z0-9\ u4e00 -\ u9fa5] {1pc29} $/

Test whether it is all in Chinese

/ [\ u4E00 -\ u9FA5\ uF900-\ uFA2D] /

These are the basic regular expression commands shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report