In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
I would like to share with you what the Chinese regular expression is like. I believe most people don't know much about it, so share this article for your reference. I hope you will learn a lot after reading this article. Let's learn about it!
How about Chinese regular expressions
\ w matches only Chinese, numbers and letters. For Chinese people, only matching Chinese is often used, see below
Regular expressions that match Chinese characters: [\ u4e00 -\ u9fa5]
Maybe you also need to match double-byte characters. Chinese is also double-byte characters.
Match double-byte characters (including Chinese characters): [^\ X00 -\ xff]
Note: it can be used to calculate the length of a string (a double-byte character length meter 2recom ASCII character counter 1)
More common regular expression matching rules:
English letter: [a-zA-Z]
Number: [0-9]
Match Chinese, English letters and numbers and _:
/ / codefrom http://caibaojian.com/zhongwen-regexp.html
^ [\ u4e00 -\ u9fa5_a-zA-Z0-9] + $
Regular expressions of letters, numbers, underscores and Chinese characters
1. Regular expressions that have only letters, numbers, and underscores and cannot begin and end with an underscore: ^ (?! _) (?!. *? _ $) [a-zA-Z0-9] + $
Only letters and numbers: ^ [a-zA-Z0-9 _] + $
two。 At least one Chinese character, number, letter, underscore: "[a-zA-Z0-9 _\ u4e00 -\ u9fa5] +"
3. The regular expression of at least one Chinese character: "^ [\ u4e00 -\ u9fa5]"
4. Up to 10 Chinese characters: ValidationExpression= "^ [\ u4e00 -\ u9fa5] {0jue 10}"
5. It contains only Chinese characters, numbers, letters and underscores and cannot begin and end with an underscore: ^ (?! _) (?!. *? _ $) [a-zA-Z0-9 _\ u4e00 -\ u9fa5] + $
Explanation:
^ matches the beginning of the string
(? _) cannot start with _
(?. *? _ $) cannot end with _
[a-zA-Z0-9 _\ u4e00 -\ u9fa5] + at least one Chinese character, number, letter, underscore
$matches the end of the string
6. A regular expression that contains only Chinese characters, numbers, letters, underscores, not the beginning and end of an underscore:
^ (! _) (?!. *? _ $) [a-zA-Z0-9 _\ u4e00 -\ u9fa5] + $
The above is all the content of the article "what is the Chinese regular expression?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.