© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
C
C#
•
3y ago
•
88 replies
Chris TCC
❔ trim string according to regex
I
've got this regex string
,
^(?:\b\w+\b[\s\r\n]*){1,25}$
^(?:\b\w+\b[\s\r\n]*){1,25}$
which is supposed to verify the string doesn
't have more than 25 words
.
How do I use this regex
(or modifications of it
) to trim the string to 25 words if it
's longer than that
?
(when the regex check fails
)
C#
Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Recent Announcements
Similar Threads
Was this page helpful?
Yes
No
Next page
Similar Threads
✅ how do i trim this string
C
C# / help
4y ago
❔ Regex to find string between _ or next uppercase letter
C
C# / help
4y ago
✅ Replace regex-pattern with dynamically generated string.
C
C# / help
3y ago
❔ Sort dictionary according to the list of string (sorted keys)
C
C# / help
4y ago