I am writing a regular expression which matches a string with the following conditions. if the string does not match, it will prevent the user from typing(in a UI textbox).
- must have at least one alphabet
- may start or end with
"',-
- must not have spaces at the start or end
- may contain numbers
- may have space in the middle of the string
This is what I have so far. but it allows the text to end with a space.
^["',-]*[a-zA-Z][a-zA-Z0-9"',\ ]*[a-zA-Z0-9"']$