ss="code">(* A function that extracts the content of the first element with the given tag *)

let contentOf tag xmlString =
  Js.Re.fromString ("&lt;" ^ tag ^ "&gt;(.*?)&lt;\\/" ^ tag ^"&gt;")
    |&gt; Js.Re.exec xmlString
    |&gt; function
      | Some result -&gt; Js.Nullable.to_opt (Js.Re.captures result).(1)
      | None -&gt; None
</code></pre>  </pre>
                    </div>
                    </div>

                  
<pre><span id="VALfromStringWithFlags"><span class="keyword">val</span> from