admin管理员组

文章数量:1410682

Please see below examples which needs to be satisfied with the regular expression.

Rule : 4-12 alphanumeric characters or special characters (~!@$%&*_+) at least one letter, no spaces

test                  ---------This is Valid
test@2                ---------This is Valid 
test2                 ---------This is Valid
2222                  ---------This is NOT Valid
2222@                 ---------This is NOT Valid 
@2222                 ---------This is NOT Valid
test user2            ---------This is NOT Valid
testUser              ---------This is Valid
testUser@2            ---------This is Valid 
testUser2             ---------This is Valid
testUser.2            ---------This is NOT Valid

Please see below examples which needs to be satisfied with the regular expression.

Rule : 4-12 alphanumeric characters or special characters (~!@$%&*_+) at least one letter, no spaces

test                  ---------This is Valid
test@2                ---------This is Valid 
test2                 ---------This is Valid
2222                  ---------This is NOT Valid
2222@                 ---------This is NOT Valid 
@2222                 ---------This is NOT Valid
test user2            ---------This is NOT Valid
testUser              ---------This is Valid
testUser@2            ---------This is Valid 
testUser2             ---------This is Valid
testUser.2            ---------This is NOT Valid
Share Improve this question edited Apr 1, 2014 at 19:38 Gyhth 1,1659 silver badges22 bronze badges asked Apr 1, 2014 at 19:36 Pawan PinjarkarPawan Pinjarkar 11 gold badge1 silver badge1 bronze badge 2
  • 1 What have you tried so far? – Shreyos Adikari Commented Apr 1, 2014 at 19:37
  • A tool like this helps you test as you go: regexpal. – DrLivingston Commented Apr 1, 2014 at 19:40
Add a ment  | 

1 Answer 1

Reset to default 0

This might work

/(?! )(?=.*[a-zA-Z])[a-zA-Z~!@$%&*_+]{4,12}/g

DEMO

本文标签: