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 Flex regular expressions

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

Share

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

Editor to share with you how to use common Flex regular expressions. I hope you will get something after reading this article. Let's discuss it together.

Flex regular expression syntax

. Matches any single character except the newline character "\ n".

[] matches any character in parentheses. Use "-" to indicate the range of characters. If the * * character is the suppressed symbol "^", its meaning becomes to match the character in parentheses to aid any character.

* matches zero or more occurrences of the previous Flex regular expression.

+ matches one or more occurrences of the previous regular expression.

? Matches the zero or more occurrences of the previous Flex regular expression.

{} varies according to what is in parentheses. A single number {n} means that the previous pattern is repeated n times, such as: [Amurz] {3}; {N1 n1-n2 N2}; {name} indicates that it is replaced with a name.

\ if it is followed by a lowercase letter, it is a C escape sequence, otherwise the following characters are referenced.

() groups a series of regular expressions. Each of "*", "+" and "{}" acts directly on the expression on its left, while "|" usually affects the Flex regular expression on the left and everything on the right.

"..." Match the contents in quotation marks

Matches the previous expression only if the following expression is followed.

The * * character of the ^ Flex regular expression, which matches the beginning of the line; it is used for negation in square brackets, and there is no special case otherwise.

The * character of the $regular expression that matches the end of the line-there are no other special cases.

A column or column within the angle brackets at the beginning of a pattern so that that pattern applies only to the specified starting state.

In flex, this particular pattern matches the end of the file.

After reading this article, I believe you have some understanding of "how to use common Flex regular expressions". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

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