<?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 Help! in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/218083#M64104</link>
    <description>&lt;P&gt;Just two comments:&lt;/P&gt;

&lt;P&gt;1) If your number is hexadecimal then the SS at the end is wrong. If that was the case simply do the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search
| rex field=myfield max_match=0 "(?&amp;lt;newfield&amp;gt;[0-9a-fA-F]{2})"
| eval newfield = mvjoin(newfield, ":")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) If your word can contain any characters (I don't understand the 0x then) you can try this instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search
| eval myfield = substr(myfield, 3)
| rex field=myfield max_match=0 "(?&amp;lt;newfield&amp;gt;[0-9a-zA-Z]{2})"
| eval newfield = mvjoin(newfield, ":")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that helps&lt;/P&gt;</description>
    <pubDate>Fri, 30 Sep 2016 15:46:24 GMT</pubDate>
    <dc:creator>javiergn</dc:creator>
    <dc:date>2016-09-30T15:46:24Z</dc:date>
    <item>
      <title>Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/218081#M64102</link>
      <description>&lt;P&gt;How can I change the format of the filed values using regex.&lt;/P&gt;

&lt;P&gt;what it is now:&lt;BR /&gt;
0xBCDDADAF7BSS&lt;/P&gt;

&lt;P&gt;What I need:&lt;BR /&gt;
remove 0x and : in between after 2 characters&lt;/P&gt;

&lt;P&gt;BC:DD:AD:AF:7B:SS&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 15:18:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/218081#M64102</guid>
      <dc:creator>kiran331</dc:creator>
      <dc:date>2016-09-30T15:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/218082#M64103</link>
      <description>&lt;P&gt;add to your search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\w\w(?&amp;lt;ppp1&amp;gt;.{2})(?&amp;lt;ppp2&amp;gt;.{2})(?&amp;lt;ppp3&amp;gt;.{2})(?&amp;lt;ppp4&amp;gt;.{2})(?&amp;lt;ppp5&amp;gt;.{2})(?&amp;lt;ppp6&amp;gt;.{2})" | eval mynewfield=ppp1+":"+ppp2+":"+ppp3+":"+ppp4+":"+ppp5+":"+ppp6
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 15:40:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/218082#M64103</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-09-30T15:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/218083#M64104</link>
      <description>&lt;P&gt;Just two comments:&lt;/P&gt;

&lt;P&gt;1) If your number is hexadecimal then the SS at the end is wrong. If that was the case simply do the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search
| rex field=myfield max_match=0 "(?&amp;lt;newfield&amp;gt;[0-9a-fA-F]{2})"
| eval newfield = mvjoin(newfield, ":")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) If your word can contain any characters (I don't understand the 0x then) you can try this instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search
| eval myfield = substr(myfield, 3)
| rex field=myfield max_match=0 "(?&amp;lt;newfield&amp;gt;[0-9a-zA-Z]{2})"
| eval newfield = mvjoin(newfield, ":")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that helps&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 15:46:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/218083#M64104</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-09-30T15:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/218084#M64105</link>
      <description>&lt;P&gt;A longer alternative..........&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count as text | eval text = "0xBCDDADAF7BSS" | rex field=text "0x(?&amp;lt;text_trim&amp;gt;.*)" | eval text_trim_colon = text_trim | rex field=text_trim_colon mode=sed "s/(..)/&amp;amp;:/g" | rex field=text_trim_colon "(?&amp;lt;text_trim_colon_result&amp;gt;.*):"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With the added bonus of handling fields of different lengths (multiples of 2)&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 15:48:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/218084#M64105</guid>
      <dc:creator>msivill_splunk</dc:creator>
      <dc:date>2016-09-30T15:48:22Z</dc:date>
    </item>
  </channel>
</rss>

