Insert a new line before a list number


#1

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?


#2
  1. Open Find and Replace with Cmd+F on macOS or Ctrl+F on other platforms
  2. Make sure that Regex is enabled (it’s the button on the right that has .* on it)
  3. Enter (\d+\.) in the Find field
  4. Enter \n$1 in the Replace field
  5. Click the “Replace All” button

Before:

After:

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.


#3

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.