I have a plain text document that is entirely on one line, though there are several list numbers, i.e. 1. , 2. , 3. , etc. that are contained within it. What would be the easiest way of inserting a new line or a line break before each number all at once, without having to go through the document and insert them individually before each one?
- Open Find and Replace with Cmd+F on macOS or Ctrl+F on other platforms
- Make sure that Regex is enabled (it’s the button on the right that has
(\d+\.)in the Find field
\n$1in the Replace field
- Click the “Replace All” button
Regular expressions are a way of describing patterns of text and can be used for many text processing tasks like you have here. It is a very useful technology to learn. I also recommend the book Mastering Regular Expressions.
Thank you for the help and the recommendation. I have heard of regular expressions but know precious little about them, so your reply was very helpful.