<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to generate a regular expression to extract the email from my _raw event? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-regular-expression-to-extract-the-email-from/m-p/340885#M101085</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex "(?&amp;lt;email&amp;gt;[\w\d\.\-]+\@[\w\d\.]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR better&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex "string\&amp;gt;(?&amp;lt;email&amp;gt;[\w\d\.\-]+\@[\w\d\.]+)\&amp;lt;"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 06 Mar 2017 19:36:35 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-03-06T19:36:35Z</dc:date>
    <item>
      <title>How to generate a regular expression to extract the email from my _raw event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-regular-expression-to-extract-the-email-from/m-p/340883#M101083</link>
      <description>&lt;P&gt;Help me with regular expression in search to pick &lt;BR /&gt;
&lt;A href="mailto:hello2017@gmail.com"&gt;hello2017@gmail.com&lt;/A&gt; from _raw event below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;string&amp;gt;hello2017@gmail.com&amp;lt;/string&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2017 19:01:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-regular-expression-to-extract-the-email-from/m-p/340883#M101083</guid>
      <dc:creator>sravankaripe</dc:creator>
      <dc:date>2017-03-06T19:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a regular expression to extract the email from my _raw event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-regular-expression-to-extract-the-email-from/m-p/340884#M101084</link>
      <description>&lt;P&gt;There is nothing 100% &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; , but as &lt;A href="http://emailregex.com/"&gt;per this site&lt;/A&gt; which can reach 99.99% pattern is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Full example below &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval _raw="&amp;lt;string&amp;gt;hello2017@gmail.co.uk&amp;lt;/string&amp;gt;" | rex field=_raw "(?&amp;lt;emailaddr&amp;gt;[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)"| table _raw, emailaddr
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2017 19:36:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-regular-expression-to-extract-the-email-from/m-p/340884#M101084</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2017-03-06T19:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a regular expression to extract the email from my _raw event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-regular-expression-to-extract-the-email-from/m-p/340885#M101085</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex "(?&amp;lt;email&amp;gt;[\w\d\.\-]+\@[\w\d\.]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR better&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex "string\&amp;gt;(?&amp;lt;email&amp;gt;[\w\d\.\-]+\@[\w\d\.]+)\&amp;lt;"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2017 19:36:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-regular-expression-to-extract-the-email-from/m-p/340885#M101085</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-06T19:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a regular expression to extract the email from my _raw event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-regular-expression-to-extract-the-email-from/m-p/340886#M101086</link>
      <description>&lt;P&gt;Here's three answers to your question.  Look for the section of the regex that has an @ in the middle of it, and look right and left until you find the edge of the part that is getting the email. &lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/310664/regex-to-extract-multiple-email-addresses-in-splun.html"&gt;https://answers.splunk.com/answers/310664/regex-to-extract-multiple-email-addresses-in-splun.html&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/426212/how-to-extract-only-unique-email-ids-from-a-detail.html"&gt;https://answers.splunk.com/answers/426212/how-to-extract-only-unique-email-ids-from-a-detail.html&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/170066/how-to-write-regex-to-extract-multiple-email-addre.html"&gt;https://answers.splunk.com/answers/170066/how-to-write-regex-to-extract-multiple-email-addre.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Once you have something you think will work for your stuff, test it over at regex101.com.  &lt;/P&gt;

&lt;P&gt;Finally, try this in splunk with YOUR version of the regex until it works for your data. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval myvalue="&amp;lt;string&amp;gt;hello2017@gmail.com&amp;lt;/string&amp;gt;" 
| rex field=myvalue "(?&amp;lt;myemail&amp;gt;.*@.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The results of what I put above are not exactly correct, but the code will run enough that you can fix it by putting your working regex in the last line.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 19:38:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-regular-expression-to-extract-the-email-from/m-p/340886#M101086</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-03-06T19:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a regular expression to extract the email from my _raw event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-regular-expression-to-extract-the-email-from/m-p/340887#M101087</link>
      <description>&lt;P&gt;I was gonna make him work for it, since even a cursory google found several easy answers on answer.splunk.com.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 19:40:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-regular-expression-to-extract-the-email-from/m-p/340887#M101087</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-03-06T19:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a regular expression to extract the email from my _raw event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-regular-expression-to-extract-the-email-from/m-p/340888#M101088</link>
      <description>&lt;P&gt;your base search | rex "(?[\w\d.-_]+\@[\w\d.-_]+)"&lt;/P&gt;

&lt;P&gt;If you feel some other special character would be there on email ID or dmail field, add them along with "\w\d.-_" inside [] in both places &lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 13:27:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-regular-expression-to-extract-the-email-from/m-p/340888#M101088</guid>
      <dc:creator>ckp123</dc:creator>
      <dc:date>2019-04-02T13:27:43Z</dc:date>
    </item>
  </channel>
</rss>

