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--
This article mainly explains "the role of some special symbols that represent abstract meaning in Flex regular expressions". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. Please follow Xiaobian's train of thought to study and learn "the role of some special symbols in Flex regular expressions that represent abstract meaning".
Some special symbols representing abstract meaning in Flex regular expressions
◆ some symbols represent special meanings of abstraction in Flex regular expressions:
Expression function
^
Matches the beginning of the string and does not match any characters
$
Matches the end of the string, not any characters
\ b
Matches a word boundary, that is, the position between a word and a space, and does not match any characters
◆ 's further textual description is still quite abstract, so examples help you understand the meaning of special symbols in Flex regular expressions.
Example 1: when the expression "^ aaa" matches "xxxaaaxxx", the result is: failed. Because "^" requires a match with the beginning of the string, "^ aaa" can match only if "aaa" is at the beginning of the string, such as "aaaxxxxxx".
Example 2: when the expression "aaa$" matches "xxxaaaxxx", the matching result is: failed. Because "$" requires a match with the end of the string, "aaa$" can match only if "aaa" is at the end of the string, such as "xxxxxxaaa".
Example 3: the expression ".\ b." When matching "@ abc", the match result is: successful; the match content is "@ a"; the match position is: starts at 2 and ends at 4.
Further explanation: "\ b", similar to "^" and "$", does not match any characters, but it requires it to be on the left and right sides of the matching result, with a "\ w" range on one side and a non-"\ w" range on the other.
Example 4: when the expression "\ bend\ b" matches "weekend,endfor,end", the matching result is: successful; the matching content is "end"; the matching position is: starts at 15 and ends at 18.
◆ some symbols can affect the relationship between subexpressions within an Flex regular expression:
Expression function
| | OR relationship between left and right expressions, matching left or right () |
(1)。 When the number of matches is modified, the expression in parentheses can be modified as a whole
(2)。 When taking the matching result, the content matched by the expression in parentheses can be obtained separately.
Example 5: when the expression "Tom | Jack" matches the string "IsimmTomMagol heisJack", the matching result is: successful; the matching content is: "Tom"; the matching position is: starts at 4 and ends at 7. When matching the next one, the match result is: successful; the match content is "Jack"; when the match is reached, it starts at 15 and ends at 19.
Example 6: the expression "(go\ s *) +" matches "Let'sgogogo!" The match result is: successful; the match to the content is: "gogogo"; the match position is: starts at 6 and ends at 14.
Example 7: the expression "¥(\ d +\.?\ d*)" when matching "$10.9, ¥20.5", the result of the match is: success; the content of the match is "¥20.5"; the position of the match is: starts at 6 and ends at 10. Get the parenthesis range separately to match: "20.5".
Thank you for your reading, the above is the content of "the role of some special symbols in Flex regular expressions that represent abstract meaning". After the study of this article, I believe you have a deeper understanding of the role of some special symbols in Flex regular expressions that represent abstract meaning, 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.
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.