Regex


#1

find a regexp in line 1 that validates that a string contains only characters between a to k 5 to 9, a “z” and a @.


#2

Hi jaisaram!

I assume your question is about how to solve this issue?

Make sure that you look for the correct class of characters which is : [a-k5-9z@]. If you only include this much then it only checks whether any of these characters appear in the expression, however we want only these characters to appear from the beginning to the end, so add ^ and $: ^[a-k5-9z@]$. We also want to make sure they appear once or more, so add “+”: ^[a-k5-9z@]+$