Details
-
Type:
Bug
-
Status: Closed (View Workflow)
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: 10.5.5
-
Fix Version/s: N/A
-
Component/s: Documentation
-
Labels:
Description
In the PCRE page, it is written:
Note that look-ahead and look-behind assertions can only be of fixed length; you cannot have repetition operators or alternations with different lengths
It is true that for a look-behind, the pattern should have a fixed-length. However, for a look-ahead, this is not requested.
More information from PERL documentation.
Example:
WITH log(X) AS ( |
VALUES |
-- 'over' does not match because 'cute' does not end with a digit |
('Do you know the droid? It is over-cute <3'), |
('I think it is BB-8.'), |
-- 'BB' does not match because it is preceded by 'not'. |
('No it is not BB-8. It is R2-D2.') |
)
|
-- Search a word preceding by 'is ' and followed by '-\\w*\\d'
|
SELECT REGEXP_SUBSTR(X, 'is \\K\\w+(?=-\\w*\\d)') |
FROM log; |
Returns:
(''), |
('BB'), |
('R2') |