It seems like BigQuery regexp does not support lookahead functionality. Does anybody know if this is correct, and if it is, is there any plan to support it sometime soon?
Lookahead is used as an assertion in Python regular expressions to determine success or failure whether the pattern is ahead i.e to the right of the parser's current position. They don't match anything. Hence, they are called as zero-width assertions.
The positive lookahead construct is a pair of parentheses, with the opening parenthesis followed by a question mark and an equals sign. You can use any regular expression inside the lookahead (but not lookbehind, as explained below). Any valid regular expression can be used inside the lookahead.
2) BigQuery Regex: RegexP_EXTRACTRegexP_EXTRACT considers two inputs that return a substring matching a regular expression. If the regular expression contains a capturing group (matching pattern), the function will return a substring that matches the capturing group.
BigQuery regex uses re2. It appears that there are no plans to add lookaround assertions (or backreferences, incidentally) to re2. As far as I can tell, the hard limit on adding them is finding an adequate implementation that maintains linear running time, as guaranteed by re2.
In my opinion, though, the point at which you add backreferences or lookaround assertions to a regex is a really good time to revisit whether regex is really the right tool for the job.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With