I am trying to extract the value for a particular key 'xyz' and tried the below regex expression to accomplish it. Is this an effective method to deal with key value pairs? Can someone suggest me if there is any other solution which is more effective. Thank you.
**
- Input & SQL :-
**
SELECT FIRST( SPLIT( regexp_extract(kvp,r'SuppressFlexCacheHydrationIndicator=(.*)&'), '&' ) ) AS SuppressFlexCacheHydrationIndicator,
regexp_extract(kvp,r'campaignName=(.*)$') AS campaign,
regexp_extract(LOWER(kvp),r'resultcode=(.*)&') AS resultcode,
FROM ( SELECT 'SuppressFlexCacheHydrationIndicator=True&templateVersionId=5&vmtaText=mail2&sequenceId=300&resultCode=DoNotMailBounceList&campaignName=classicimport' AS kvp )
Output :-
SuppressFlexCacheHydrationIndicator campaign resultcode
True classicimport donotmailbouncelist
Comments :-
In the above SQL I am using FIRST(SPLIT()) to extract the sub-string from the input which I think that it's not effective and can be implemented just by using regular expression.Please kindly share your insights if there is any other possible solution. Thanks.