I have this pattern in urls and I need to extract the 4 digit numbers out of the url. The patter looks like this:
hotel1234
/1234.html
I tried
select sdate,url,
case when url like '/%.html' then substring_index(url,'.',1)
when url REGEXP 'HOTEL'+'[0-9].{4}' then left(substring_index(url,'HOTEL',-1),4)
else url
end digit
from urltable
This does not work on some of the url. i would like to regexp on '/1234.html',what is the right expression?