I need a regular expression which accepts both alphanumeric and also alphabets but not numerics alone, and special characters allowed are .(dot) and _(underscore).
Valid entries are
1.ABC123de (alphanumeric- irrespective of the case)
2. ABCDEfgh (only alphabets – irrespective of the case)
3. Abc_.123 (only special characters allowed are _ and .)
Invalid entry:666666(numeric alone)
Thanks,
Balaji
[A-Za-z0-9._]*[A-Za-z]+[A-Za-z0-9._]*Will match any string with alphanumeric or the two special characters, provided it contains at least one alphabetic character.
Edit: You seem to be discovering a lot of requirements as we go… The pattern below will match a string which starts with a letter or
_, ends with an letter or digit and consists only of letters, digits,.and_.^[\\p{L}_](?[\\p{L}\\d._]*[\\p{L}\\d])?$