title: Can we use regex within sed
body: <p>I have a sample file with many sections. There can be multiple new lines within a section. So, we can encounter multiple new lines (\n) within a section.</p>
  
  <pre><code>Section1
  
  Section2
  (
      (a)   (b)
      (c)   (d)
      (e)   (f)
  ))
  
  Section 3
  </code></pre>
  
  <p>I want to replace all the contents of Section 2 with some other content. So, one thing I am aware is that section closes with consecutive ) brace. Is there a way I can do it via a <code>sed</code> using regex. I want to do it via only shell script only.</p>
  
  <p>I know I can give </p>
  
  <p><code>sed/findpattern/replacementtext/g</code> </p>
  
  <p>How do I add a <code>regex</code> here to populate <code>findpattern</code>. Can I give a full fledged regex here?</p>
  
  <p>Expected Output</p>
  
  <pre><code> Section1
  
      Section2
      (
          (m)   (n)
          (o)   (p)
          (q)   (r)
      ))
  
      Section 3
  </code></pre>
  
  <p>Only Section 2 contents need to be found first and then it needs to be replaced with some content like above.</p>