<?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: regex address in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706148#M238999</link>
    <description>&lt;P&gt;Creating the regex would be easy enough but it looks like your data is already coming in JSON or XML format.&amp;nbsp; Is there a chance that the fields are already extracted as "city" and "state"?&amp;nbsp; If not then I would recommend revisiting the ingestion props as a best practice.&amp;nbsp; Rather than creating a lot of regex at search time if you had that field extraction during indexing then any changes to data would auto extract new fields.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;.*\"city\"\:\"(?&amp;lt;city&amp;gt;[^\"]+)\"\,\"state\"\:"(?&amp;lt;test&amp;gt;[^\"]+)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Dec 2024 14:34:50 GMT</pubDate>
    <dc:creator>dural_yyz</dc:creator>
    <dc:date>2024-12-06T14:34:50Z</dc:date>
    <item>
      <title>regex address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706143#M238995</link>
      <description>&lt;P&gt;im trying to capture address, city and state that are in one line but they have ", : and ,&lt;BR /&gt;i would like to excluede (Quotes Coma and Colon)&lt;BR /&gt;see test example below&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;12345 noth test Avenue","city":"test","state":"test",&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 13:53:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706143#M238995</guid>
      <dc:creator>CyberWolf</dc:creator>
      <dc:date>2024-12-06T13:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: regex address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706146#M238997</link>
      <description>&lt;P&gt;Are you trying to capture the data in a single field or multiple fields?&amp;nbsp; Is this to be done at index time or search time?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 14:32:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706146#M238997</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-12-06T14:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: regex address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706147#M238998</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/273420"&gt;@CyberWolf&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;if the logs you have, you can use a regex like the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "^[^,]+,\"city\":\"(?&amp;lt;city&amp;gt;[^\"]+)\",\"state\":\"(?&amp;lt;state&amp;gt;[^\"]+)"&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/ZafgnI/1" target="_blank"&gt;https://regex101.com/r/ZafgnI/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I'd be more detailed if you can share a complete log, not onl a part of it.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 14:33:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706147#M238998</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-12-06T14:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: regex address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706148#M238999</link>
      <description>&lt;P&gt;Creating the regex would be easy enough but it looks like your data is already coming in JSON or XML format.&amp;nbsp; Is there a chance that the fields are already extracted as "city" and "state"?&amp;nbsp; If not then I would recommend revisiting the ingestion props as a best practice.&amp;nbsp; Rather than creating a lot of regex at search time if you had that field extraction during indexing then any changes to data would auto extract new fields.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;.*\"city\"\:\"(?&amp;lt;city&amp;gt;[^\"]+)\"\,\"state\"\:"(?&amp;lt;test&amp;gt;[^\"]+)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 14:34:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706148#M238999</guid>
      <dc:creator>dural_yyz</dc:creator>
      <dc:date>2024-12-06T14:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: regex address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706152#M239000</link>
      <description>&lt;P&gt;thanks but i think i wasn't clear what im trying to do is that all that to be in one field called (?&amp;lt;address&amp;gt;) not separated with city and state&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 15:42:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706152#M239000</guid>
      <dc:creator>CyberWolf</dc:creator>
      <dc:date>2024-12-06T15:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: regex address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706154#M239001</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/273420"&gt;@CyberWolf&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;let me understand, you want only one field, called address containing city and state, is it correct?&lt;/P&gt;&lt;P&gt;in this case, please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| rex ".*\"city\"\:\"(?&amp;lt;city&amp;gt;[^\"]+)\"\,\"state\"\:"(?&amp;lt;test&amp;gt;[^\"]+)"
| eval address=state." ".city&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 15:45:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706154#M239001</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-12-06T15:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: regex address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706155#M239002</link>
      <description>&lt;P&gt;correct it comes in json and i dont have control of it, but im trying to have is address city and state to be all in the field and ignore coma quotes and :&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 15:46:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706155#M239002</guid>
      <dc:creator>CyberWolf</dc:creator>
      <dc:date>2024-12-06T15:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: regex address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706156#M239003</link>
      <description>&lt;P&gt;all in a single field so i can used later to dc (distinguish count)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 15:47:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706156#M239003</guid>
      <dc:creator>CyberWolf</dc:creator>
      <dc:date>2024-12-06T15:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: regex address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706164#M239004</link>
      <description>&lt;P&gt;example from the raw logs:&lt;BR /&gt;"address":"1234 Nothing 2C Avenue","city":"something","state":"RD"&lt;/P&gt;&lt;P&gt;would like to have field name Address&lt;BR /&gt;Address&lt;BR /&gt;1234 Nothing 2C Avenue City something state RD&lt;/P&gt;&lt;P&gt;all that in one field so ignore the " , and :&lt;BR /&gt;&lt;BR /&gt;What i have&lt;BR /&gt;index=something&lt;BR /&gt;| rex field=_raw "address\"\:\"(?&amp;lt;address&amp;gt;.*?)\"\,\"&lt;BR /&gt;which shows field name:&lt;BR /&gt;address&lt;BR /&gt;1234 Nothing 2C Avenue","city":"something","state":"RD"&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 16:10:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706164#M239004</guid>
      <dc:creator>CyberWolf</dc:creator>
      <dc:date>2024-12-06T16:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: regex address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706168#M239006</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/273420"&gt;@CyberWolf&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;please try:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| rex "^\"address\":\"(?&amp;lt;address&amp;gt;[^\"]+)\",\"city\":\"(?&amp;lt;city&amp;gt;[^\"]+)\",\"state\":\"(?&amp;lt;state&amp;gt;[^\"]+)"
| eval address=address." City ".city." state ".state&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 17:03:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706168#M239006</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-12-06T17:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: regex address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706174#M239007</link>
      <description>&lt;P&gt;Thank you all it worked! (Grazie mile!) YEAHHH&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 17:16:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-address/m-p/706174#M239007</guid>
      <dc:creator>CyberWolf</dc:creator>
      <dc:date>2024-12-06T17:16:21Z</dc:date>
    </item>
  </channel>
</rss>

