Zikra Noman
Zikra Noman

Reputation: 67

SQL REGEX EXPRESSION to match a string

I am using the below SQL REGEX expression to check values in a column named as 'details' containing values like "000daf02-aef7-472a-b39c-de064d8ea6fd". But is giving "Invalid". It should ideally give output as "Valid". What am I missing?

select 
 case when trim(details) REGEXP '^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$'       
then 'valid' else 'invalid'
end as details_validity

Upvotes: -3

Views: 78

Answers (0)

Related Questions