<?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: Need help in writing regex (PCRE) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-writing-regex-PCRE/m-p/469054#M132025</link>
    <description>&lt;P&gt;Hi pal_sumit1,&lt;BR /&gt;
if you have only three fields with the possibility that the second one (email) could have more values, or, in a more general use case, you have only one field that could have more than values and this field is an email, you could use three different regexes for the three fields:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "^(?&amp;lt;id&amp;gt;[^,]*),"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can test at &lt;A href="https://regex101.com/r/MtUP2K/1"&gt;https://regex101.com/r/MtUP2K/1&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex max_match=100 ",(?&amp;lt;email&amp;gt;[^@]*@[^,]*),"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can test at &lt;A href="https://regex101.com/r/MtUP2K/2"&gt;https://regex101.com/r/MtUP2K/2&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex ".*,(?&amp;lt;name&amp;gt;.*)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can test at &lt;A href="https://regex101.com/r/MtUP2K/3"&gt;https://regex101.com/r/MtUP2K/3&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Thu, 24 Oct 2019 10:26:05 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2019-10-24T10:26:05Z</dc:date>
    <item>
      <title>Need help in writing regex (PCRE)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-writing-regex-PCRE/m-p/469053#M132024</link>
      <description>&lt;P&gt;HI All,&lt;/P&gt;

&lt;P&gt;We have events where some fields are having multiple value , below is the example&lt;/P&gt;

&lt;P&gt;event1 : &lt;BR /&gt;
           123,&lt;A href="mailto:s@gmail.com"&gt;s@gmail.com&lt;/A&gt;,abc &lt;BR /&gt;
here &lt;BR /&gt;
id = 123&lt;BR /&gt;
email = &lt;A href="mailto:s@gmail.com"&gt;s@gmail.com&lt;/A&gt;&lt;BR /&gt;
name = abc&lt;/P&gt;

&lt;P&gt;Event2 : &lt;BR /&gt;
           124,&lt;A href="mailto:g@gmail.com"&gt;g@gmail.com&lt;/A&gt;,&lt;A href="mailto:f@gmail.com"&gt;f@gmail.com&lt;/A&gt;,bcd&lt;/P&gt;

&lt;P&gt;Here &lt;BR /&gt;
id = 124&lt;BR /&gt;
email = &lt;A href="mailto:g@gmail.com"&gt;g@gmail.com&lt;/A&gt;,&lt;A href="mailto:f@gmail.com"&gt;f@gmail.com&lt;/A&gt;&lt;BR /&gt;
name = bcd &lt;BR /&gt;
So the email field is not fixed it may have multiple values separated by commas , I need help in writing regex(pcre) for these types of data .&lt;/P&gt;

&lt;P&gt;Thanks In advance&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2019 10:01:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-writing-regex-PCRE/m-p/469053#M132024</guid>
      <dc:creator>pal_sumit1</dc:creator>
      <dc:date>2019-10-24T10:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in writing regex (PCRE)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-writing-regex-PCRE/m-p/469054#M132025</link>
      <description>&lt;P&gt;Hi pal_sumit1,&lt;BR /&gt;
if you have only three fields with the possibility that the second one (email) could have more values, or, in a more general use case, you have only one field that could have more than values and this field is an email, you could use three different regexes for the three fields:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "^(?&amp;lt;id&amp;gt;[^,]*),"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can test at &lt;A href="https://regex101.com/r/MtUP2K/1"&gt;https://regex101.com/r/MtUP2K/1&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex max_match=100 ",(?&amp;lt;email&amp;gt;[^@]*@[^,]*),"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can test at &lt;A href="https://regex101.com/r/MtUP2K/2"&gt;https://regex101.com/r/MtUP2K/2&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex ".*,(?&amp;lt;name&amp;gt;.*)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can test at &lt;A href="https://regex101.com/r/MtUP2K/3"&gt;https://regex101.com/r/MtUP2K/3&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2019 10:26:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-writing-regex-PCRE/m-p/469054#M132025</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-24T10:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in writing regex (PCRE)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-writing-regex-PCRE/m-p/469055#M132026</link>
      <description>&lt;P&gt;Hi gcusello,&lt;/P&gt;

&lt;P&gt;The no. of fields are more than 30 .. the above regex will not work for that many fields and I need to add this regex in props.conf&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2019 11:02:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-writing-regex-PCRE/m-p/469055#M132026</guid>
      <dc:creator>pal_sumit1</dc:creator>
      <dc:date>2019-10-24T11:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in writing regex (PCRE)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-writing-regex-PCRE/m-p/469056#M132027</link>
      <description>&lt;P&gt;Hi pal_sumit1,&lt;BR /&gt;
The no of fields isn't a problem for this approach, the mandatory rules are:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;there's only one field with multivalue,&lt;/LI&gt;
&lt;LI&gt;this field has an identifiable and unic (in your logs) format (like email) so it's possible to indentify multiple values.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Anyway you can put them in props.conf, otherwise (as a workaround) you can put in props all the other fields and use rex command only for the multivalue field.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2019 11:33:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-writing-regex-PCRE/m-p/469056#M132027</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-24T11:33:00Z</dc:date>
    </item>
  </channel>
</rss>

