<?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 Can you help me with the following query using regex: missing terminating ] for character class in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420068#M120770</link>
    <description>&lt;P&gt;So I tested this regex with regex101 and it seems to be working but Splunk doesn't seem to like it. Any ideas?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "^(?:{\"publish_time\": )(?P&amp;lt;PublishTime&amp;gt;[^,]+)?|(?:\"ver\\\" : \\\")(?P&amp;lt;Ver&amp;gt;[^\\]+)|(?:\"storeId\\\" : \\\")(?P&amp;lt;StoreNum&amp;gt;[^\\]+)|(?:\"MSRReach\\\" : \\\")(?P&amp;lt;ScannerConnection&amp;gt;[^\\]+)|(?:\"isConnected\\\" : )(?P&amp;lt;ConnectedStatus&amp;gt;[^,]+)|(?:\"isProduction\\\" : )(?P&amp;lt;Prod&amp;gt;[^,]+)|(?:\"serialNumber\\\" : \\\")(?P&amp;lt;ScannerSerialNum&amp;gt;[^\\]+)|(?:\"OSVersion\\\" : \\\")(?P&amp;lt;ScannerOSVersion&amp;gt;[^\\]+)|(?:\"model\\\" : \\\")(?P&amp;lt;ScannerModel&amp;gt;[^\\]+)|(?:\"Serial\\\" : \\\")(?P&amp;lt;iPadSerial&amp;gt;[^\\]+)|(?:\"battery\\\" : \\\")(?P&amp;lt;iPadBattery&amp;gt;[^\\]+)|(?:\"osVersion\\\" : \\\")(?P&amp;lt;iPadOSVersion&amp;gt;[^\\]+)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is what the log looks like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"publish_time": 1548432475.596, "data": {"insertId": "xueeeeees", "receiveTimestamp": "2019-01-21T15:51:31.311111132Z", "logName": "projects/nitro-mobile/logs/boot", "labels": {"compute.awsapis.com/resource_name": "-------", "container.awsapis.com/pod_name": "-----------", "container.awsapis.com/stream": "----", "container.awsapis.com/namespace_name": "---------"}, "jsonPayload": {"thread": "http-nitro", "timestamp": "1548432475.596", "message": "payload=2019/01/01  StartEvent {\n  \"appDetails\" : {\n    \"version\" : \"1\",\n    \"number\" : \"1\",\n    \"ver\" : \"11.1.0\",\n    \"release\" : \"11.1.1\",\n    \"storeId\" : \"0120\",\n    \"terminalId\" : \"41\"\n  },\n  \"capTime\" : \"2019-01-01 10:59:48\",\n  \"MSR\" : {\n    \"MSRReach\" : \"Scanner not connected\",\n    \"version\" : \"Not available\",\n    \"isConnected\" : true,\n    \"SB\" : \"\"\n  },\n  \"isProduction\" : true,\n  \"pinpad\" : {\n    \"serialNumber\" : \"111-112-111-111\",\n    \"OSVersion\" : \"AWS12343\",\n    \"model\" : \"910X5\"\n  },\n  \"MDM\" : {\n    \"lastSeen\" : \"Not Available\"\n  },\n  \"device\" : {\n    \"Serial\" : \"BV12AXAJ013J\",\n    \"battery\" : \"100.0\",\n    \"network\" : \"ReachableViaWiFi\",\n    \"osVersion\" : \"11.0.1\",\n    \"memory\" : \"100\"\n  }\n} EndEvent\n", 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Mon, 21 Jan 2019 19:57:50 GMT</pubDate>
    <dc:creator>JoshuaJohn</dc:creator>
    <dc:date>2019-01-21T19:57:50Z</dc:date>
    <item>
      <title>Can you help me with the following query using regex: missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420068#M120770</link>
      <description>&lt;P&gt;So I tested this regex with regex101 and it seems to be working but Splunk doesn't seem to like it. Any ideas?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "^(?:{\"publish_time\": )(?P&amp;lt;PublishTime&amp;gt;[^,]+)?|(?:\"ver\\\" : \\\")(?P&amp;lt;Ver&amp;gt;[^\\]+)|(?:\"storeId\\\" : \\\")(?P&amp;lt;StoreNum&amp;gt;[^\\]+)|(?:\"MSRReach\\\" : \\\")(?P&amp;lt;ScannerConnection&amp;gt;[^\\]+)|(?:\"isConnected\\\" : )(?P&amp;lt;ConnectedStatus&amp;gt;[^,]+)|(?:\"isProduction\\\" : )(?P&amp;lt;Prod&amp;gt;[^,]+)|(?:\"serialNumber\\\" : \\\")(?P&amp;lt;ScannerSerialNum&amp;gt;[^\\]+)|(?:\"OSVersion\\\" : \\\")(?P&amp;lt;ScannerOSVersion&amp;gt;[^\\]+)|(?:\"model\\\" : \\\")(?P&amp;lt;ScannerModel&amp;gt;[^\\]+)|(?:\"Serial\\\" : \\\")(?P&amp;lt;iPadSerial&amp;gt;[^\\]+)|(?:\"battery\\\" : \\\")(?P&amp;lt;iPadBattery&amp;gt;[^\\]+)|(?:\"osVersion\\\" : \\\")(?P&amp;lt;iPadOSVersion&amp;gt;[^\\]+)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is what the log looks like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"publish_time": 1548432475.596, "data": {"insertId": "xueeeeees", "receiveTimestamp": "2019-01-21T15:51:31.311111132Z", "logName": "projects/nitro-mobile/logs/boot", "labels": {"compute.awsapis.com/resource_name": "-------", "container.awsapis.com/pod_name": "-----------", "container.awsapis.com/stream": "----", "container.awsapis.com/namespace_name": "---------"}, "jsonPayload": {"thread": "http-nitro", "timestamp": "1548432475.596", "message": "payload=2019/01/01  StartEvent {\n  \"appDetails\" : {\n    \"version\" : \"1\",\n    \"number\" : \"1\",\n    \"ver\" : \"11.1.0\",\n    \"release\" : \"11.1.1\",\n    \"storeId\" : \"0120\",\n    \"terminalId\" : \"41\"\n  },\n  \"capTime\" : \"2019-01-01 10:59:48\",\n  \"MSR\" : {\n    \"MSRReach\" : \"Scanner not connected\",\n    \"version\" : \"Not available\",\n    \"isConnected\" : true,\n    \"SB\" : \"\"\n  },\n  \"isProduction\" : true,\n  \"pinpad\" : {\n    \"serialNumber\" : \"111-112-111-111\",\n    \"OSVersion\" : \"AWS12343\",\n    \"model\" : \"910X5\"\n  },\n  \"MDM\" : {\n    \"lastSeen\" : \"Not Available\"\n  },\n  \"device\" : {\n    \"Serial\" : \"BV12AXAJ013J\",\n    \"battery\" : \"100.0\",\n    \"network\" : \"ReachableViaWiFi\",\n    \"osVersion\" : \"11.0.1\",\n    \"memory\" : \"100\"\n  }\n} EndEvent\n", 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 19:57:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420068#M120770</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2019-01-21T19:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using regex: missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420069#M120771</link>
      <description>&lt;P&gt;This is the error I keep getting: missing terminating ] for character class&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 19:59:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420069#M120771</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2019-01-21T19:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using regex: missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420070#M120772</link>
      <description>&lt;P&gt;HI,&lt;/P&gt;

&lt;P&gt;normaly this error will tell you that slashes haven`t bin escaped correctly.&lt;/P&gt;

&lt;P&gt;Please see the post of landen99 here &lt;A href="https://answers.splunk.com/answers/29739/should-i-be-escaping-each-backslash-with-a-second-backslash-in-my-regex.html#answer-214500"&gt;https://answers.splunk.com/answers/29739/should-i-be-escaping-each-backslash-with-a-second-backslash-in-my-regex.html#answer-214500&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;in rex you have to escaped differently than in fieldextraction.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/594708/what-is-wrong-with-my-regex-regex-missing-terminat.html"&gt;https://answers.splunk.com/answers/594708/what-is-wrong-with-my-regex-regex-missing-terminat.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope that makes sense.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 20:35:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420070#M120772</guid>
      <dc:creator>dkeck</dc:creator>
      <dc:date>2019-01-21T20:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using regex: missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420071#M120773</link>
      <description>&lt;P&gt;Thats what I thought was the issue but whenever I add more backslashes I only get the results from my first capture&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 20:49:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420071#M120773</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2019-01-21T20:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using regex: missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420072#M120774</link>
      <description>&lt;P&gt;If you get results by adding backslashes then you've fixed the error.  The next step is to fix the regex to return the expected results.  The reason you get only your first capture group back is because have put an OR operator (|) between each keyword/value pair.  That tells regex to return the first matching pair.&lt;/P&gt;

&lt;P&gt;If your field always appear in the same order, try this regular expression.  It's much more efficient.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?:{\"publish_time\": )(?P&amp;lt;PublishTime&amp;gt;[^,]+).*?(?:\"ver\\\" : \\\")(?P&amp;lt;Ver&amp;gt;[^\\]+).*?(?:\"storeId\\\" : \\\")(?P&amp;lt;StoreNum&amp;gt;[^\\]+).*?(?:\"MSRReach\\\" : \\\")(?P&amp;lt;ScannerConnection&amp;gt;[^\\]+).*?(?:\"isConnected\\\" : )(?P&amp;lt;ConnectedStatus&amp;gt;[^,]+).*?(?:\"isProduction\\\" : )(?P&amp;lt;Prod&amp;gt;[^,]+).*?(?:\"serialNumber\\\" : \\\")(?P&amp;lt;ScannerSerialNum&amp;gt;[^\\]+).*?(?:\"OSVersion\\\" : \\\")(?P&amp;lt;ScannerOSVersion&amp;gt;[^\\]+).*?(?:\"model\\\" : \\\")(?P&amp;lt;ScannerModel&amp;gt;[^\\]+).*?(?:\"Serial\\\" : \\\")(?P&amp;lt;iPadSerial&amp;gt;[^\\]+).*?(?:\"battery\\\" : \\\")(?P&amp;lt;iPadBattery&amp;gt;[^\\]+).*?(?:\"osVersion\\\" : \\\")(?P&amp;lt;iPadOSVersion&amp;gt;[^\\]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Jan 2019 22:29:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420072#M120774</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-01-21T22:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using regex: missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420073#M120775</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "^(?:{\"publish_time\": )(?&amp;lt;PublishTime&amp;gt;[^,]+)?|(?:\"ver\\\" : \\\")(?&amp;lt;Ver&amp;gt;[^\\\]+)|(?:\"storeId\\\" : \\\")(?&amp;lt;StoreNum&amp;gt;[^\\\]+)|(?:\"MSRReach\\\" : \\\")(?&amp;lt;ScannerConnection&amp;gt;[^\\\]+)|(?:\"isConnected\\\" : )(?&amp;lt;ConnectedStatus&amp;gt;[^,]+)|(?:\"isProduction\\\" : )(?&amp;lt;Prod&amp;gt;[^,]+)|(?:\"serialNumber\\\" : \\\")(?&amp;lt;ScannerSerialNum&amp;gt;[^\\\]+)|(?:\"OSVersion\\\" : \\\")(?&amp;lt;ScannerOSVersion&amp;gt;[^\\\]+)|(?:\"model\\\" : \\\")(?&amp;lt;ScannerModel&amp;gt;[^\\\]+)|(?:\"Serial\\\" : \\\")(?&amp;lt;iPadSerial&amp;gt;[^\\\]+)|(?:\"battery\\\" : \\\")(?&amp;lt;iPadBattery&amp;gt;[^\\\]+)|(?:\"osVersion\\\" : \\\")(?&amp;lt;iPadOSVersion&amp;gt;[^\\\]+)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Jan 2019 00:49:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420073#M120775</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-22T00:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using regex: missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420074#M120776</link>
      <description>&lt;P&gt;Unfortunately still getting the same issue with your regex statement&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 14:45:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420074#M120776</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2019-01-22T14:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using regex: missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420075#M120777</link>
      <description>&lt;P&gt;Try mine; I tested it in splunk.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 15:25:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420075#M120777</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-22T15:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using regex: missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420076#M120778</link>
      <description>&lt;P&gt;Sorry somehow missed it! The only issue is I need all the fields, and the pipe is only giving me the first field.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 15:44:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420076#M120778</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2019-01-22T15:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using regex: missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420077#M120779</link>
      <description>&lt;P&gt;You are using &lt;CODE&gt;|&lt;/CODE&gt; which means &lt;CODE&gt;OR&lt;/CODE&gt;.  In any case, the questions was asking about your syntax error and that seems to be fixed, right?  So you should &lt;CODE&gt;Accept&lt;/CODE&gt; and answer, &lt;CODE&gt;UpVote&lt;/CODE&gt; anything helpful, and if you have a different problem now, post another question.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 15:55:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420077#M120779</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-22T15:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using regex: missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420078#M120780</link>
      <description>&lt;P&gt;Agreed. Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 15:58:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-regex-missing/m-p/420078#M120780</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2019-01-22T15:58:06Z</dc:date>
    </item>
  </channel>
</rss>

