String extraction in dremio

Hello guys ,

I will appreciate any idea on how to extract the first email the delimiter is “-” , but the keep in mind the delimiter is also present within the mail.

This was my first execution but it stripped other part of the string,where it found “-”

select (case when position('-' in '') <> 0 then substr('', position('-' in '')-1 end)

output → “yello”

In SQL Sever the query below works, but I am stuck with implementing it dremio

Select substring('',0,PATINDEX('%.%-%','')+4)

Any help will be of great value,

Thank you.

Thank you guys I think I figured out the issue.

(case when position('-' in '') <> 0 then substr('',0,strpos('' ,'.')+3) end) email