i was programming some code in which i have to enter text in a particular format only.
i.e.
2
10 5 kdsfj ejkd kjdf
7 8 sdkj dsjklf ckjsd dksj
and so on
but i have to enter the data form a text file having the whole as a string as
2 10 5 kdsfj ejkd kjdf7 8 sdkj dsjklf ckjsd dksj6 12 kjd ekjr fkjdr fdkj
but i want to suppy the text as given above format.
Bold letters are saparable points.
i want a program so that it can add a newline after character or space followed by digit ?
How can i do that ?
The answer is going to be some form of regex
Where input is your source line from the file, and the pattern matches you specific criteria. With the above replace you end up with:
Your additional comments clarified the line breaks when joined to a previous character; although I am still not sure why 2 ends up on its own line?