Click here to Skip to main content
15,880,405 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a multi text area for the label called "Description" and that could match all characters,digits and special characters. Only condition is that it could have only maximum of 3 carriage return. If we have 4 carriage return hit, it should not match.

Eg : Valid case
123abc
fgtu566
ftuu344

Invalid Case (It should nonmatch since it have 4 carriage return)
123abc
fgtu566
ftuu344
ffrrtt3333

What I have tried:

Eg : Valid case
123abc
fgtu566
ftuu344

Invalid Case (It should nonmatch since it have 4 carriage return)
123abc
fgtu566
ftuu344
ffrrtt3333
Posted
Updated 27-Oct-22 20:46pm
Comments
Sandeep Mewara 25-Oct-22 1:03am    
In regex you can use the \r to catch the carriage return. For every input, see how many of it is there and accordingly act. BTW, for newline, it's \n.
Richard Deeming 25-Oct-22 7:56am    
The What I have tried section is where you are supposed to show us what you have tried, and explain where you are stuck. Just repeating your two sample test cases suggests you've tried nothing, and want someone to do all the work for you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900