An RE2 class instance is a compiled representation of an RE2 regular expression, independent of the public Java-like Pattern/Matcher API. This class also contains various implementation helpers for RE2 regular expressions. Use the #quoteMeta(String) utility function to quote all re
| 44 | * href='package.html'>package-level documentation</a> for an overview of how to use this API. |
| 45 | */ |
| 46 | class RE2 { |
| 47 | |
| 48 | // (In the Go implementation this structure is just called "Regexp".) |
| 49 | |
| 50 | //// Parser flags. |
| 51 | |
| 52 | // Fold case during matching (case-insensitive). |
| 53 | static final int FOLD_CASE = 0x01; |
| 54 | |
| 55 | // Treat pattern as a literal string instead of a regexp. |
| 56 | static final int LITERAL = 0x02; |
| 57 | |
| 58 | // Allow character classes like [^a-z] and [[:space:]] to match newline. |
| 59 | static final int CLASS_NL = 0x04; |
| 60 | |
| 61 | // Allow '.' to match newline. |
| 62 | static final int DOT_NL = 0x08; |
| 63 | |
| 64 | // Treat ^ and $ as only matching at beginning and end of text, not |
| 65 | // around embedded newlines. (Perl's default). |
| 66 | static final int ONE_LINE = 0x10; |
| 67 | |
| 68 | // Make repetition operators default to non-greedy. |
| 69 | static final int NON_GREEDY = 0x20; |
| 70 | |
| 71 | // allow Perl extensions: |
| 72 | // non-capturing parens - (?: ) |
| 73 | // non-greedy operators - *? +? ?? {}? |
| 74 | // flag edits - (?i) (?-i) (?i: ) |
| 75 | // i - FoldCase |
| 76 | // m - !OneLine |
| 77 | // s - DotNL |
| 78 | // U - NonGreedy |
| 79 | // line ends: \A \z |
| 80 | // \Q and \E to disable/enable metacharacters |
| 81 | // (?P<name>expr) for named captures |
| 82 | // \C (any byte) is not supported. |
| 83 | static final int PERL_X = 0x40; |
| 84 | |
| 85 | // Allow \p{Han}, \P{Han} for Unicode group and negation. |
| 86 | static final int UNICODE_GROUPS = 0x80; |
| 87 | |
| 88 | // Regexp END_TEXT was $, not \z. Internal use only. |
| 89 | static final int WAS_DOLLAR = 0x100; |
| 90 | |
| 91 | static final int MATCH_NL = CLASS_NL | DOT_NL; |
| 92 | |
| 93 | // As close to Perl as possible. |
| 94 | static final int PERL = CLASS_NL | ONE_LINE | PERL_X | UNICODE_GROUPS; |
| 95 | |
| 96 | // POSIX syntax. |
| 97 | static final int POSIX = 0; |
| 98 | |
| 99 | //// Anchors |
| 100 | static final int UNANCHORED = 0; |
| 101 | static final int ANCHOR_START = 1; |
| 102 | static final int ANCHOR_BOTH = 2; |
| 103 |
nothing calls this directly
no outgoing calls
no test coverage detected