<pre><code>import re

string = &quot;&quot;&quot;Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
Further information can be referred to this [arXiv article]`(https://arxiv.org/abs/2109.05857).`&quot;&quot;&quot;

pattern=re.compile('\((https://arxiv.org[^\)]+|arxiv.org[^\)]+)', re.MULTILINE)
pattern.findall(string)

#output
#['https://arxiv.org/abs/2109.05857']
</code></pre>
Matching arxiv regular expression in Python
<p>I have paragraph and from it I want to extract the arxiv dois. For example, this is the given paragraph:</p>
<pre><code>&quot;Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

Further information can be referred to this [arXiv article]`(https://arxiv.org/abs/2109.05857).`&quot;
</code></pre>
<p>The output should be: <code>https://arxiv.org/abs/2109.05857</code>.
The start of arxiv doi will always be &quot;https://arxiv.org&quot; or &quot;arxiv.org&quot; and the appeded string could be anything.</p>
<p>I tried <code>exp = re.findall(&quot;^https://arxiv.org*&quot;, str)</code> but it doesn't work.</p>
<p>Any help will be appreciating.</p>