<?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 to insert &amp;quot;:&amp;quot; after every second character in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364102#M107477</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;I have a string of all uppercase letters (no digits) I need a regex to insert a ":" after every second character FAGHIJGN becomes FA:GH:IJ:GN How can I do this with a regex?&lt;/P&gt;

&lt;P&gt;Thanks in advance,&lt;BR /&gt;
Coen&lt;/P&gt;</description>
    <pubDate>Sat, 12 Aug 2017 13:18:37 GMT</pubDate>
    <dc:creator>coenvandijk</dc:creator>
    <dc:date>2017-08-12T13:18:37Z</dc:date>
    <item>
      <title>Regex to insert ":" after every second character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364102#M107477</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;I have a string of all uppercase letters (no digits) I need a regex to insert a ":" after every second character FAGHIJGN becomes FA:GH:IJ:GN How can I do this with a regex?&lt;/P&gt;

&lt;P&gt;Thanks in advance,&lt;BR /&gt;
Coen&lt;/P&gt;</description>
      <pubDate>Sat, 12 Aug 2017 13:18:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364102#M107477</guid>
      <dc:creator>coenvandijk</dc:creator>
      <dc:date>2017-08-12T13:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to insert ":" after every second character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364103#M107478</link>
      <description>&lt;P&gt;If with search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex mode=sed "s/(\w{2})(?=\w{1,2})/\1:/g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If with props:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; SEDCMD-aaa = s/(\w{2})(?=\w{1,2})/\1:/g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;These work too:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex mode=sed "s/(\w{2})(?=\w+)/\1:/g"

SEDCMD-aaa = s/(\w{2})(?=\w+)/\1:/g
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 12 Aug 2017 23:13:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364103#M107478</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-08-12T23:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to insert ":" after every second character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364104#M107479</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=YourFieldNameHere mode=sed "s/(.{2})/\1:/g s/:$//"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 13 Aug 2017 03:31:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364104#M107479</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-08-13T03:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to insert ":" after every second character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364105#M107480</link>
      <description>&lt;P&gt;@jkat54 - As coded, wouldn't that be limited to even numbers of pairs?  I think you want that second &lt;CODE&gt;\w{2}&lt;/CODE&gt; to be a positive lookahead, and only add the colon after &lt;CODE&gt;\1&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | rex mode=sed "s/(\w{2})(?=\w{2})/\1:/g"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 13 Aug 2017 20:21:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364105#M107480</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-13T20:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to insert ":" after every second character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364106#M107481</link>
      <description>&lt;P&gt;@woodcock - Holy crud, &lt;CODE&gt;sed&lt;/CODE&gt; mode allows multiple replacements in a single call?  &lt;/P&gt;

&lt;P&gt;That would simplify the ... presentation, lets say... of my more complicated uses of the &lt;CODE&gt;format&lt;/CODE&gt; command.&lt;/P&gt;

&lt;P&gt;I have a NEW TOY!&lt;/P&gt;

&lt;P&gt;See why I keep you guys around? &lt;/P&gt;</description>
      <pubDate>Sun, 13 Aug 2017 20:36:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364106#M107481</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-13T20:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to insert ":" after every second character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364107#M107482</link>
      <description>&lt;P&gt;Worked on regex101.com with even or odd numbers of letters.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Aug 2017 20:57:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364107#M107482</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-08-13T20:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to insert ":" after every second character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364108#M107483</link>
      <description>&lt;P&gt;Ah I was able to break it... and fix it&lt;/P&gt;

&lt;P&gt;Your approach is better but doesn't work with 5,7,etc&lt;/P&gt;

&lt;P&gt;This does:&lt;/P&gt;

&lt;P&gt;(\w{2})(?=\w{1,2})&lt;/P&gt;

&lt;P&gt;Updating my answer&lt;/P&gt;</description>
      <pubDate>Sun, 13 Aug 2017 21:02:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364108#M107483</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-08-13T21:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to insert ":" after every second character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364109#M107484</link>
      <description>&lt;P&gt;Ask anybody, I am full of IT.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Aug 2017 21:20:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364109#M107484</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-08-13T21:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to insert ":" after every second character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364110#M107485</link>
      <description>&lt;P&gt;@jkat54 - good point, but you can kill the {1,2} as redundant, since it's a zero length assertion so {1} is enough.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 03:21:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-insert-quot-quot-after-every-second-character/m-p/364110#M107485</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-14T03:21:35Z</dc:date>
    </item>
  </channel>
</rss>

