retrieve name, phone number, url and role with regex
<p>Is it possible to do complex regex operations to retrieve name, role, designation in python? I have attached the pic for my requirement.
<a href="http://i.stack.imgur.com/xqqMz.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/xqqMz.jpg" alt="enter image description here"></a></p>

<p>The answer is Yes and No. </p>

<p>Regex is pattern matching. Anything that follows a specific pattern like phone number and url, yes you can extract that information using Regex with a great degree of accuracy.</p>

<p>Refer:</p>

<p><a href="http://stackoverflow.com/questions/3868753/find-phone-numbers-in-python-script">Regex for phone number</a></p>

<p><a href="https://mathiasbynens.be/demo/url-regex" rel="nofollow">Regex for url</a></p>

<p>For roles &amp; designation, if there is a manageable list that be used as anchors, it is still possible to use regex to retrieve this information.</p>

<p>Retrieving names can be tricky or simple depending on how uniformly you capture the data. I have shared a simple example that will look for 2 consecutive words with first letter capitalized separated by a space. However it might have to be tweaked to include cases that does not follow this pattern.</p>

<pre><code>^([A-Z]\w+)\s([A-Z]\w+).*?
</code></pre>

<p>So in summary, I would say yes you can use regex to some extend but it may or may not be the best solution depending on what you are trying to achieve.</p>

python regex nltk