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

How to use regexp_instr function in mysql

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "the use of regexp_instr function in mysql". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the use of regexp_instr function in mysql".

1. The function returns the substring position of the matching pattern pat in the string expr. If no matching substring is found, 0 is returned.

2. If expr or pat is NULL, the function returns NULL. The position of the character starts at 1.

Optional parameters:

Pos means to start the search at the specified location of the string expr. By default, the match starts with the first character.

Occurrence indicates the number of matches returned. By default, the substring position of the first match is returned.

Return_option represents the type of location returned. If the parameter is 0 (the default), the position of the first character of the substring is returned; if the parameter is 1, the position of the first character after the substring is returned.

Match_type represents the way it matches, and the parameters are the same as the REGEXP_LIKE () function above.

Example

Mysql > SELECT REGEXP_INSTR ('dog cat dog',' dog') +-- + | REGEXP_INSTR ('dog cat dog' 'dog') | +-+ | 1 | +-+ mysql > SELECT REGEXP_INSTR (' dog cat dog', 'dog', 2) +-- + | REGEXP_INSTR ('dog cat dog',' dog' 2) | +-- + | 9 | +-- + mysql > SELECT REGEXP_INSTR ('aa aaa aaaa', 'a {2}') +-- + | REGEXP_INSTR ('aa aaa aaaa' 'a {2}') | +-- + | 1 | +-+ mysql > SELECT REGEXP_INSTR ('aa aaa aaaa', 'a {4}') +-- + | REGEXP_INSTR ('aa aaa aaaa' 'a {4}') | +-+ | 8 | +-+ Thank you for your reading The above is the content of "the use of regexp_instr function in mysql". After the study of this article, I believe you have a deeper understanding of the use of regexp_instr function in mysql, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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