I need a regex to meet the following requirements:
- Only letters, periods and whitespace are allowed.
- No white space at the beginning and at the end of the string.
- White space in the middle of the string is OK, but not two consecutive white spaces.
Matches:
"Hello world."
"Hello World. This is ok."
Not Matches:
" Hello World. "
"Hello world 123."
"Hello world."
This worked in my case
<asp:RegularExpressionValidator ID="revDescription" runat="server"
ControlToValidate="taDescription" Display="Dynamic" ErrorMessage="Invalid Description."
Text=" "
ValidationExpression="^(?i)(?![ ])(?!.*[ ]{2})(?!.*[ ]$)[A-Z. ]{8,20}$"></asp:RegularExpressionValidator>