regex in teradata, how to pass two values in

99 views Asked by At

I have the following regex which works, but I need to find this expression if shop_id also

   regexp_substr(field_text ,'(?<=\?page_id\=)(.*?)(?=\&)' ,1 ,1, 'i')

I tried this:

   regexp_substr(fullurl ,'(?<=(\?page_id\=|/page_id/))(.*?)(?=\&)' ,1 ,1, 'i')

But it states this is not a valid pattern, can someone please explain why not, as it works in regex sites.

1

There are 1 answers

0
dnoeth On BEST ANSWER

You need to add round brackets for the alternative expression:

REGEXP_SUBSTR(fullurl ,'(?<=\?(page|shop)_id\=)(.*?)(?=\&)' ,1 ,1, 'i')