Redshift SQL REGEXP_SUBSTRING

Viewed 11

I have a string of the following type:

'Wall/2.0 (Brick; Stone; GR-222) Dust/537.8 (Hole, like Big) Imp/2.0.898.23'

From this above string, I want to extract the first occurance of the word between ( and ;. In the above string, the result should be Brick

I tried the following query(Redshift) using regexp_substr:

select regexp_substr('Wall/2.0 (Brick; Stone; GR-222) Dust/537.8 (Hole, like Big) Imp/2.0.898.23', '\\((.*);', 0, 1, 'e);

But, this outputs Brick; Stone.

Can someone please help me to write a proper regex expression, such that the query output should result a string between ( and first occurance of ;. Brick should be the ooutput in the above string

0 Answers
Related