Regular Expression for Long Words

In web applications, some times Long Words without spaces kills the UI design. Generally, QA's tested the application by giving the long words without spaces, if you don't the limit the size of a filed. In this scenario, it breaks the UI design of the page.In order to avoid those situations, we need to restrict the user, not to enter that long space less words.
Following is the Regular Expression validator which allows the user to enter long space less words upto 29 characters only.

<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtName" ErrorMessage="Word is too long" Display="None" ValidationExpression="(?!.*?\S{30,}).*">asp:RegularExpressionValidator>


    Blogger Comment
    Facebook Comment


Post a Comment