How to use\ v metacharacters in regular expressions
This article will explain in detail how to use\ v metacharacters in regular expressions. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
The following table contains a complete list of metacharacters and their behavior in the context of regular expressions:
Character description\
Marks the next character as a special character, or a literal character, or a backward reference, or an octal escape character. For example,'n 'matches the character "n".' \ n' matches a newline character. The sequence'\ 'matches "\" and "(" matches "(".
^
Matches the starting position of the input string. If the Multiline property of the RegExp object is set, ^ also matches the position after'\ n'or'\ r'.
$
Matches the end position of the input string. If the Multiline property of the RegExp object is set, $also matches the position before'\ n'or'\ r'.
*
Matches the previous subexpression zero or more times. For example, zo* can match "z" and "zoo". * is equivalent to {0,}.
+
Matches the previous subexpression one or more times. For example, 'zo+' can match "zo" and "zoo", but not "z". + is equivalent to {1,}.
?
Matches the previous subexpression zero or once. For example, "do (es)?" Can match "do" or "does". ? It is equivalent to {0jue 1}.
{n}
N is a non-negative integer. Match the determined n times. For example,'o {2} 'does not match the' o'in 'Bob', but does match the two o in 'food'.
{n,}
N is a non-negative integer. Match at least n times. For example,'o {2,} 'does not match' o'in 'Bob', but does match all o in 'foooood'. O {1,}'is equivalent to 'oasis'. O {0,}'is equivalent to 'oval'.
{n,m}
M and n are non-negative integers, where n