❔ trim string according to regex
I've got this regex string,
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)
^(?:\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)