0

I am looking for a regex that matches the string consisting of zero or more specified special characters(. and _ ) with at least 2 alphanumerics.

I tried using /[a-zA-Z._]{2,}&/

But that is failing for Eg _. - failed to check at least 2 alphanumerics.

Expectation is -

.sds_erc - return True,

.e__u. - return True,

._u_ - return False

1 Answer 1

1
/^[._]*(?:[a-zA-Z][._]*){2,}/

Any number of specials, as a prefix. Then, at least two alphanumerics followed by any number of specials.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.