<?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 Why am I unable to extract a field from my logs with rex using my current regular expression? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-a-field-from-my-logs-with-rex-using/m-p/186996#M53869</link>
    <description>&lt;P&gt;In my logs, I have the below part and I want to extract &lt;STRONG&gt;success&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{\"state\":\"success\",
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I formulate it with rex? I know that I should escape the backslashes and quotes but adding a &lt;CODE&gt;\&lt;/CODE&gt; does not do the trick. This is what I have tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\\\"state\\\":\\\"(?&amp;lt;state&amp;gt;\w*)\\\""
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 16 Mar 2015 18:16:12 GMT</pubDate>
    <dc:creator>mitcanmit</dc:creator>
    <dc:date>2015-03-16T18:16:12Z</dc:date>
    <item>
      <title>Why am I unable to extract a field from my logs with rex using my current regular expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-a-field-from-my-logs-with-rex-using/m-p/186996#M53869</link>
      <description>&lt;P&gt;In my logs, I have the below part and I want to extract &lt;STRONG&gt;success&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{\"state\":\"success\",
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I formulate it with rex? I know that I should escape the backslashes and quotes but adding a &lt;CODE&gt;\&lt;/CODE&gt; does not do the trick. This is what I have tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\\\"state\\\":\\\"(?&amp;lt;state&amp;gt;\w*)\\\""
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Mar 2015 18:16:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-a-field-from-my-logs-with-rex-using/m-p/186996#M53869</guid>
      <dc:creator>mitcanmit</dc:creator>
      <dc:date>2015-03-16T18:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to extract a field from my logs with rex using my current regular expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-a-field-from-my-logs-with-rex-using/m-p/186997#M53870</link>
      <description>&lt;P&gt;Your regex string worked perfectly on regex101.com, but sometimes Splunk gets confused by quotation marks within strings.  Try this alternative:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"\\\x22state\\\x22:\\\x22(?&amp;lt;state&amp;gt;\w*)\\\x22"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Mar 2015 18:26:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-a-field-from-my-logs-with-rex-using/m-p/186997#M53870</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-03-16T18:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to extract a field from my logs with rex using my current regular expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-a-field-from-my-logs-with-rex-using/m-p/186998#M53871</link>
      <description>&lt;P&gt;Give this a try as well &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex   "(\\\)*\"state(\\\)*\":(\\\)*\"(?&amp;lt;state&amp;gt;\w*)(\\\)*\""
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Mar 2015 21:00:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-a-field-from-my-logs-with-rex-using/m-p/186998#M53871</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-03-16T21:00:47Z</dc:date>
    </item>
  </channel>
</rss>

