Valid Regex Not so valid in PHP : <p>So i want to extract everything in between form tags (including the tags them selves). </p>

<p>The form is as below:</p>

<pre><code>&lt;body&gt;&lt;br /&gt;
    &lt;!-- 
&lt;form method="POST" action="#"&gt;
&lt;table style="table-layout: fixed; border: 1px solid #ffffff; " border="1"&gt;
            &lt;!-- 
&lt;col width="50"&gt; --&gt;&lt;/p&gt;
&lt;tr style="width: 1154px; background-color: #0d56c2; vertical-align: middle; color: #ffffff; height: 70px; "&gt;
&lt;td style="width: 413px; text-align: center;"&gt;Calls&lt;/td&gt;
&lt;td style="background-color: #D6DCE5; width: 319px; padding-left: 20px; padding-top: 15px;"&gt;&lt;input type="text" name="calls" value="150" style="width: 173px;"&gt;&lt;/td&gt;
&lt;td style="width: 412px; padding: 5px; vertical-align: middle;"&gt; in a period of &lt;input name="period" value="5" style="width: 173px; "&gt;&amp;nbsp;&lt;br /&gt;
                    &lt;select name="callUnit" style="width: 100px; height: 29px; position: absolute;"&gt;&lt;option value="hour" selected&gt;hours&lt;/option&gt;&lt;option value="minute" &gt;minutes&lt;/option&gt;&lt;/select&gt;
                &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
&lt;/body&gt;
</code></pre>

<p>Regex i am using is: <code>&lt;form.*&gt;[\s\S]*&lt;\/form&gt;</code> and according to <a href="https://regex101.com/" rel="nofollow noreferrer">regex101</a> This is a valid regular expression that should extract form tags + everthing in between. </p>

<p>However using the above regular expression in preg_match i get the following error: <code>Warning: preg_match(): Unknown modifier '['</code></p>
