Hi Joe,
There was a discrepancy between the documentation and the actual code. The fix is in the work. In the meantime, regexp_replace can be used to simulate this by specifying the starting position and ending position in the pattern with the characters '^' and '$' respectively so that the entire matching string will be replaced by the desired group/sub expression. Note that the group/sub expression must be preceded by a backlash.
Example:
regexp_replace( thesql -- source_string
,'^SELECT\s+([\w]+)\.?([\w]+)(?:[\s])(?:AS)?\s+(\w+)\s+FROM\s+(\w+)\.(\w+)\s+(?:AS)?\s+\1$' --pattern
,'\1' --the desired group to be returned
,1 -- position_arg
,1 -- occurrence_arg
,'i' -- match_arg (Ignore case)
) as Theresult;
Hi Joe,
There was a discrepancy between the documentation and the actual code. The fix is in the work. In the meantime, regexp_replace can be used to simulate this by specifying the starting position and ending position in the pattern with the characters '^' and '$' respectively so that the entire matching string will be replaced by the desired group/sub expression. Note that the group/sub expression must be preceded by a backlash.
Example:
regexp_replace( thesql -- source_string
,'^SELECT\s+([\w]+)\.?([\w]+)(?:[\s])(?:AS)?\s+(\w+)\s+FROM\s+(\w+)\.(\w+)\s+(?:AS)?\s+\1$' --pattern
,'\1' --the desired group to be returned
,1 -- position_arg
,1 -- occurrence_arg
,'i' -- match_arg (Ignore case)
) as Theresult;