User input might look like:
*
symbol with 1 character limit (no other symbols than*
)
or
- A-E, a-e letters with 1 character limit
Following data is valid examples: *; a; A; e; D
I don't understand why ^[A-Ea-e]{1}\*?$
doesn't work?
User input might look like:
*
symbol with 1 character limit (no other symbols than *
)or
Following data is valid examples: *; a; A; e; D
I don't understand why ^[A-Ea-e]{1}\*?$
doesn't work?
You just need a character class:
^[A-Ea-e*]$
You regex is only allowing an optional *
after A-E
or a-e
but never *
alone.
Try using regex groups:
^([A-Ea-e]|\*)$
You want to have two different alternatives: