In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "SQL regular expressions and how to use regular expressions in mybatis", the content is easy to understand, clear, hope to help you solve your doubts, the following let Xiaobian lead you to study and learn "SQL regular expressions and how to use regular expressions in mybatis" this article.
The other type of pattern matching provided by mysql is using extended regular expressions.
When you do matching tests on such patterns, use the REGEXP and NOT REGEXP operators (or RLIKE and NOT RLIKE, which are synonyms).
Some of the characters that extend regular expressions are:
"." Matches any single character.
A character class "[.]" Matches any character in square brackets. For example, "[abc]" matches "a", "b", or "c". To name a range of characters, use a "-". "[amurz]" matches any lowercase letter, while "[0-9]" matches any number.
"*" matches zero or more things in front of it. For example, "x*" matches any number of "x" characters, "[0-9] *" matches any number of numbers, and ". *" matches any number of anything.
Regular expressions are case-sensitive, but if you want, you can use one character class to match both. For example, "[aA]" matches lowercase or uppercase "a" and "[a-zA-Z]" matches any of the two letters.
If it appears anywhere in the value being tested, the pattern matches (as long as they match the entire value, the SQL pattern matches).
To locate a pattern so that it must match the beginning or end of the value being tested, use "^" at the beginning of the pattern or "$" at the end of the pattern.
To illustrate how extended regular expressions work, the LIKE query shown above is rewritten using REGEXP below:
To find names that start with "b", use "^" to match the beginning of the name and "[bB]" to match lowercase or uppercase "b":
Mysql > SELECT * FROM pet WHERE name REGEXP "^ [bB]"
Use regular expressions in Myabtis yourself
Select code,label from institution where admlvl ='2' and code REGEXP "[0-9] *. [0-9] *" select code,label from institution where admlvl ='3' and code REGEXP "[0-9] *. [0-9] *. [0-9] *" select code,label from institution where admlvl ='4' and code REGEXP "[0-9] *. [0-9] *. [0-9] *\. [0-9] *" These are all the contents of the article "SQL regular expressions and how to use regular expressions in mybatis". 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.