You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to validate & restrict for beginning or ending spaces in Person Name object

Accepted answer
114
Views
4
Comments

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?

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!