Regularly labeled study notes

Regular expressions were first developed from the Perl language and are
commonly used in the java.util.regex package (back):
        Pattern class use: (matches() method)
            1. Character matching [single character]: indicates the composition of any character
                     \ \: means'\', \n line break, \t tab
            2. [Quantity: single] character set (you can choose one character from it)
                    [abc]: means any one of the characters a, b, c
                    [^ abc]: means that it is not any of the characters a, b, c
                    [a-zA-Z]: means that it is composed of any letter, not case sensitive
                    [0-9]: means any one of the numbers
            3. [Quantity: Single ]: Simplified character set:.
                    (Dot): represents any character
                    \d: equivalent to the range of "[0-9]"
                    \D: equivalent to the range of [^0-9]
                    \s: matches any one Space, may be spaces, newlines, tabs
                    \S: match any non-space data
                    \w: match letters, numbers, underscores, equivalent to [a-zA-Z_0-9]
                    \W:[^a-zA-Z_0-9]
            4. Boundary matching:
                    ^: the beginning of the matching boundary
                    $: the end of the matching boundary
            5. Quantity expression, by default, multi-character
                    expressions can be matched only if the quantity unit is added ? : The regular can appear 0 or 1 time
                    expression*: The regular can appear 0, 1 time] or multiple times
                    Expression+: The regular can appear 1 or more times
                    Expression {n}: The length of the expression Exactly n times
                    expression {n,}: the length of the expression is more than n times
                    Expression {n,m}: the length of the expression is n~m times
            6. Logical expression: multiple regular
                    expressions can be connected X Expression Y: X expression is followed by expression Y
                    expression X|expression Y: only one expression is satisfied
                    (expression): set an overall description for the expression, you can set the quantity unit for the overall description    

Guess you like

Origin blog.csdn.net/qq_41663470/article/details/113739698