title: Matching multiple heading styles using regex
body: <p>I'm trying to use regex to capture section headings, but why is it that I am able to capture "4.1 General" with this, however if I add a newline to the end of the regex <code>\n([\d\.]+ ?\w+)\n</code> it no longer captures that line? Is it not followed by a newline or am I missing something?</p>
  
  <p><a href="https://regex101.com/r/EGyxI4/1" rel="nofollow noreferrer">Here's my example for reference</a></p>
  
  <pre><code>\n([\d\.]+ ?\w+)
  </code></pre>
  
  <p><strong>Input</strong></p>
  
  <pre><code>3.6.10
  POLLUTION DEGREE 4
  continuous conductivity occurs due to conductive dust, rain or other wet conditions
  3.6.11
  CLEARANCE
  shortest distance in air between two conductive parts
  3.6.12
  CREEPAGE DISTANCE
  shortest distance along the surface of a solid insulating material between two conductive
  parts
  4 Tests
  4.1 General
  Tests in this standard are TYPE TESTS to be carried out on samples of equipment or parts.
  </code></pre>
  
  <p><code>\n([\d\.]+ ?\w+)\n?</code> doesn't seem to work either.</p>