Working with long word into Web application some times break the UI. There always be a question for How to break long words?? As a long word without space kills your user interface.
I found the reason, in general when you system is tested by QA first thing he is going to break if you don’t limit the size and then it try to break UI with adding a loooooong space less word :)
There can be lots of other solutions, like create function which finds the long word and break it out. But I like is Regx, yes the regular expression is very optimum, but you have to learn them which is not like eating piece of cake :)
Following is the Regx which validate the text box and allow user to add 35 character long word although it seems to be not possible :)
<asp:RegularExpressionValidator ID="regNoLongWords" runat="server" ControlToValidate="txtText"
ErrorMessage="Word is too long" Display="None"
ValidationExpression="(?!.*?\S{36,}).*"></asp:RegularExpressionValidator>
Have fun with Regx !!!
No comments:
Post a Comment