How to validate & restrict for beginning or ending spaces in Person Name object
Summary:
We have a requirement to restrict user not to enter spaces in the begining or ending in the first name.
Content (required):
We have written the below pattern to restrict the user not to enter spaces in the begining or ending in the first name. But how ever it is even display error msg when there is a space in between two words in the name.
^[^\s].*[^\s]$
When user enters "Aakar Rao" it is displaying error msg, ideally it should not display error msg. It displays error msg when we enter " AakarRao" as well as for "AaakarRao " (space in the starting or in the ending). How to resolve this issue?
Tagged:
1