Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the regular expression operators

Shulou Source: shulou.com Published: 2022-06-02 06:42:17 10月02日 Update

This article mainly introduces what the regular expression operators are. It is very detailed and has a certain reference value. Friends who are interested must read it!

Common matching

. (matches any single character. For example, the regular expression r.t matches these strings: rat, rut, r t, but not root)

$(match line Terminator. For example, the regular expression weasel$ can match the end of the string "He's a weasel", but not the string "They are a bunch of weasels.")

^ (matches the beginning of a line. For example, the regular expression ^ When in can match the beginning of the string "When in the course of human events", but not "What and When in the".)

* (matches the 0 or more characters that precede it. For example, the regular expression. * means that any number of characters can be matched.)

\ (this is the reference character used to match the metacharacters listed here as normal characters. For example, the regular expression\ $is used to match the dollar sign, not the end of the line, and similarly, the regular expression\. A wildcard used to match dot characters rather than any character)

[] [c1-c2] [^ c1-c2] (matches any character in parentheses. For example, the regular expression Raou] t matches rat, rot, and rut, but does not match ret. You can use a hyphen-in parentheses to specify an interval of characters, for example, the regular expression [0-9] can match any numeric character; you can also set multiple intervals, such as the regular expression [A-Za-z] can match any uppercase and lowercase letter. Another important use is "exclude". To match characters outside the specified interval-- the so-called complement-- use the ^ character between the parentheses on the left and * characters. For example, the regular expression [^ 269A-Z] will match any character except 2, 6, 9, and all uppercase letters.)

\

< \>

(the beginning of the matching word (word). For example, regular expressions\

Tags: Characters expressions regular strings letters integers points metacharacters numbers software English support intervals multiple bytes parentheses operators underscores numbers between Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi NVidia Shulou Information Shulou Tech Info Huawei