compilePOSIX is like #compile but restricts the regular expression to POSIX ERE (egrep) syntax and changes the match semantics to leftmost-longest. That is, when matching against text, the regexp returns a match that begins as early as possible in the input (leftmost), and among
(String expr)
| 177 | * even well-defined. See http://swtch.com/~rsc/regexp/regexp2.html#posix |
| 178 | */ |
| 179 | static RE2 compilePOSIX(String expr) throws PatternSyntaxException { |
| 180 | return compileImpl(expr, POSIX, /*longest=*/ true); |
| 181 | } |
| 182 | |
| 183 | // Exposed to ExecTests. |
| 184 | static RE2 compileImpl(String expr, int mode, boolean longest) throws PatternSyntaxException { |