I'm trying to split a long title into different small parts. Each small part shouldn't exceed the limit of 10 characters and I cannot find a solution...
Currently, I'm trying with /(.{10}\S*)\s/ but testing with TESLA AND MICROSOFT AND ANOTHER WORD it returns also the word that is included in the limit (TESLA AND MICROSOFT AND ANOTHER WORD) and I don't want it... I mean, the expected result should be TESLA AND that has less than 10 characters...
Is there a simple way to do it?
EDIT:
What I want to do, it to split a single-line text into multiple lines, and the line length shouldn't be greater than 10 characters if there are multiple words. If a single word is longer than 10 characters, should return the full word.
eg. TESLA AND MICROSOFT ANDANOTHERLONGWORD AND OTHER LONGWORDS
this text should be:
TESLA AND
MICROSOFT
ANDANOTHERLONGWORD
AND OTHER
LONGWORDS