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 ordinary characters and escape characters in Flex regular expressions

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

Share

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

This article mainly introduces what are the common characters and escape characters in Flex regular expressions. It is very detailed and has a certain reference value. Friends who are interested must read it!

1.Flex regular expression rules

In general, the implementation of regular expressions in different development environments or languages is not exactly the same, but the differences are very subtle. AS3 in accordance with the ECMA262 standard to achieve regular expressions, I feel that the help document on this part of the introduction is not very good, many concepts are not clear, here to find a good learning materials, if there are help documents can not understand the reference!

Ordinary characters in 1.1Flex regular expressions

Letters, numbers, Chinese characters, underscores, and punctuation marks that are not specifically defined in later chapters are all "ordinary characters". An ordinary character in an expression that matches the same character when it matches a string.

Example 1: the expression "c", when matching the string "abcde", the matching result is: successful; the matching content is: "c"; the matching position is: starts at 2 and ends at 3. (note: the subscript starts at 0 or 1, which may vary depending on the current programming language.)

Example 2: the expression "bcd", when matching the string "abcde", the matching result is: successful; the matching content is: "bcd"; the matching position is: starts at 1 and ends at 4.

Simple escape characters in 1.2Flex regular expressions

For some characters that are inconvenient to write, add "\" in front of them. In fact, we are already familiar with these characters.

Expressions can be matched

\ r,\ n

Represents carriage return and newline characters

\ t

Tab character

\\

Stands for "\" itself.

There are other punctuation marks that have special uses in later chapters, and the addition of "\" in front represents the symbol itself. For example: ^, $have a special meaning, if you want to match the "^" and "$" characters in the string, the expression needs to be written as "\ ^" and "\ $".

Expressions can be matched

\ ^

Match the ^ symbol itself

\ $

Match the $symbol itself

\.

Matches the decimal point itself.

The matching method of these escape characters is similar to that of "normal characters". It also matches the same character.

Example 1: the expression "\ $d". When matching the string "abc$de", the matching result is: successful; the matching content is: "$d"; the matching position is: starts at 3 and ends at 5.

The above is all the content of the article "what are the ordinary characters and escape characters in Flex regular expressions?" Thank you for reading! Hope to share the content to help you, more related 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.

Share To

Development

Wechat

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

12
Report