Sample Header Ad - 728x90

Extract a substring where the delimiter might appear more than once

0 votes
3 answers
1936 views
I have a column of strings with this pattern - . Email is always the first string. I would like to extract only the email address but the problem here is that an email address can also contain hyphens so I can't be certain that the delimiter will only occur once. So basically I would like to match .* until the last hyphen and extract this as email. Well it's not exactly about administration, it's about writing a query to extract data so it's in data mining area, however this forum is related to database entirely so I think it' s more appropriate than stackoverflow. I only tried with SUBSTRING_INDEX() but I ended up getting bad results with it. It's a production system so I can't really interfere with the design, hence the need to extract the info.
Asked by gabtzi (181 rep)
Jun 8, 2022, 09:23 PM
Last activity: Jun 16, 2022, 09:02 PM