I got a Regex from an API. I need to validate the regex if it is valid or not.
This is a sample regex pattern:
/^[a-z0-9_-]{6,18}$/
I need to validate this string.
Edit: I have tried initwithpattern with a invalid regex [
, But its not throwing any error.