 <blockquote> <p>I am not sure how to tell regex "look for this in a new line, if it's there, capture the line. if it's not there, just stay on the current line.</p> </blockquote> <p>You could just match the new line as part of an expression repeated multiple times, e.g:</p> <pre><code>\d{3}(\n\d{3})* </code></pre> <p>Not sure of the specifics of exactly what you want to match but this is the best I could come up with without further info...</p>