<?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 Regex Help in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/27528#M5354</link>
    <description>&lt;P&gt;A complete event record looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Row 114005: Requester Name: "RETAIL\S2343W01$" Issued Common Name: "S2343W01.retail.fakename.com" User Principal Name: "S2343W01.retail.fakename.com" Serial Number: "4c22be0100010002d317" Certificate Template: Client Authentication - Retail Desktops Certificate Effective Date: 12/1/2011 10:38 AM Certificate Expiration Date: 11/30/2012 10:38 AMMaximum Row Index: 114005
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My Regex to capture a cert_SN field looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i)Serial Number: “(?P&amp;lt;cert_SN&amp;gt;.+?\n)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The result captures the seriel number PLUS the final quote i.e. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cert_SN = 4c22be0100010002d317"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I eliminate the final quote?&lt;/P&gt;</description>
    <pubDate>Fri, 02 Dec 2011 13:48:21 GMT</pubDate>
    <dc:creator>mikefoti</dc:creator>
    <dc:date>2011-12-02T13:48:21Z</dc:date>
    <item>
      <title>Regex Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/27528#M5354</link>
      <description>&lt;P&gt;A complete event record looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Row 114005: Requester Name: "RETAIL\S2343W01$" Issued Common Name: "S2343W01.retail.fakename.com" User Principal Name: "S2343W01.retail.fakename.com" Serial Number: "4c22be0100010002d317" Certificate Template: Client Authentication - Retail Desktops Certificate Effective Date: 12/1/2011 10:38 AM Certificate Expiration Date: 11/30/2012 10:38 AMMaximum Row Index: 114005
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My Regex to capture a cert_SN field looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i)Serial Number: “(?P&amp;lt;cert_SN&amp;gt;.+?\n)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The result captures the seriel number PLUS the final quote i.e. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cert_SN = 4c22be0100010002d317"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I eliminate the final quote?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2011 13:48:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/27528#M5354</guid>
      <dc:creator>mikefoti</dc:creator>
      <dc:date>2011-12-02T13:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/27529#M5355</link>
      <description>&lt;P&gt;You can try either of these:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;(?i)Serial Number:\s\"(?P&amp;lt;cert_sn&amp;gt;\w+)\"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;(?i)Serial Number:\s\"(?P&amp;lt;cert_sn&amp;gt;\w+)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;--&amp;gt;&lt;BR /&gt;
EDIT: In case you need to capture empty fields then try this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;(?i)Serial Number:\s\"(?P&amp;lt;cert_sn&amp;gt;[^\"]*)\"&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;This will capture everything between "" even when there are no spaces between quotes. If you know for certain that there will be spaces between quotes then change &lt;CODE&gt;*&lt;/CODE&gt; to &lt;CODE&gt;+&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&amp;gt; please upvote and accept answer if you find it useful - thanks!&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2011 13:54:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/27529#M5355</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2011-12-02T13:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/27530#M5356</link>
      <description>&lt;P&gt;both work equally well both both also fail to pick up a value of EMPTY... which is weird... seems like /w ought to match EMPTY or anyother word?!?!?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2011 14:18:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/27530#M5356</guid>
      <dc:creator>mikefoti</dc:creator>
      <dc:date>2011-12-02T14:18:56Z</dc:date>
    </item>
  </channel>
</rss>

