<?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 help! Want to start after the \ and collect the user name that follows in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347380#M102875</link>
    <description>&lt;P&gt;I want to start after the \ and collect the user name but the user name is in delimited format (.)&lt;/P&gt;

&lt;P&gt;field name = UserName&lt;/P&gt;

&lt;P&gt;example of a field value&lt;/P&gt;

&lt;P&gt;BDDLOX3855\john.doe&lt;/P&gt;

&lt;P&gt;Would it be possible to replace the . with a space after using my regex request?&lt;/P&gt;</description>
    <pubDate>Tue, 31 Oct 2017 22:44:19 GMT</pubDate>
    <dc:creator>johnward4</dc:creator>
    <dc:date>2017-10-31T22:44:19Z</dc:date>
    <item>
      <title>Regex help! Want to start after the \ and collect the user name that follows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347380#M102875</link>
      <description>&lt;P&gt;I want to start after the \ and collect the user name but the user name is in delimited format (.)&lt;/P&gt;

&lt;P&gt;field name = UserName&lt;/P&gt;

&lt;P&gt;example of a field value&lt;/P&gt;

&lt;P&gt;BDDLOX3855\john.doe&lt;/P&gt;

&lt;P&gt;Would it be possible to replace the . with a space after using my regex request?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 22:44:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347380#M102875</guid>
      <dc:creator>johnward4</dc:creator>
      <dc:date>2017-10-31T22:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help! Want to start after the \ and collect the user name that follows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347381#M102876</link>
      <description>&lt;P&gt;try this&lt;/P&gt;

&lt;P&gt;your search | eval UserName= replace(UserName,".",". ")&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 05:14:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347381#M102876</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2017-11-01T05:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help! Want to start after the \ and collect the user name that follows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347382#M102877</link>
      <description>&lt;P&gt;assuming your line is BDDLOX3855\john.doe value (format is domain\username&lt;BR /&gt;
The following reg should work&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"^(?P&amp;lt;testDomain&amp;gt;[^\\\]+)\\\(?P&amp;lt;testFirstname&amp;gt;[a-z^\.]+)\.(?P&amp;lt;testLastname&amp;gt;[a-z^\s]+)\s"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note, I have also split the username to firstname and lastname. This should give you more flexibility&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 05:59:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347382#M102877</guid>
      <dc:creator>erickyi</dc:creator>
      <dc:date>2017-11-01T05:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help! Want to start after the \ and collect the user name that follows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347383#M102878</link>
      <description>&lt;P&gt;I wasn't able to get this to work, I'm really trying to grasp using regex so if would you mind explaining the regex you use to help me better understand how to write it myself?  I'm also not really interested in creating new fields for first name and another for last name.  It was mostly a would be nice if possible, to replace the . with a space show my output for UserName showed first name last name&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 18:12:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347383#M102878</guid>
      <dc:creator>johnward4</dc:creator>
      <dc:date>2017-11-01T18:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help! Want to start after the \ and collect the user name that follows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347384#M102879</link>
      <description>&lt;P&gt;This eval replaced the field data with .............. only and didn't cut the domain\ leaving just the user name as I'm looking to do&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 18:45:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347384#M102879</guid>
      <dc:creator>johnward4</dc:creator>
      <dc:date>2017-11-01T18:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help! Want to start after the \ and collect the user name that follows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347385#M102880</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search with field UserName
| eval UserName=replace(UserName,"(\w+)\\\(\w+)\.(\w+)","\2 \3")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Runanywhere sample search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval UserName="DDFDF\john.doe" | table UserName | eval UserName1=replace(UserName,"(\w+)\\\(\w+)\.(\w+)","\2 \3")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Nov 2017 19:11:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347385#M102880</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-01T19:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help! Want to start after the \ and collect the user name that follows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347386#M102881</link>
      <description>&lt;P&gt;Thank you @somesoni2!  Can you please walk me through the regex you used as I'm trying to learn&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 20:02:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347386#M102881</guid>
      <dc:creator>johnward4</dc:creator>
      <dc:date>2017-11-01T20:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help! Want to start after the \ and collect the user name that follows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347387#M102882</link>
      <description>&lt;P&gt;The regex used in replace command (2nd argument) is creating capturing group of each of the segment of the value of field UserName. E.g.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;BDDLOX3855\john.doe
{segment1}\{segment2}.{segment3}.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then, in the 3rd argument of replace command, we're displaying the captured segments as per our need (dropping segment1 and adding a space between segment2 and segment3). You can playaround with runanywhere search to get feel of the replace command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval UserName="DDFDF\john.doe" | table UserName | eval UserName1=replace(UserName,"(\w+)\\\(\w+)\.(\w+)","seg1: \1, seg2: \2, seg3: \3")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Nov 2017 20:41:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347387#M102882</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-01T20:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help! Want to start after the \ and collect the user name that follows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347388#M102883</link>
      <description>&lt;P&gt;hi john,&lt;/P&gt;

&lt;P&gt;dissecting the regex ... it is {from beginning of line}{extract the first token}{delimiter of backslash}{extract the 2nd token which is testFirstname}{delimiter of dot}{extract the 3rd token which is testLastname}{delimiter of space}&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Details&lt;/STRONG&gt;&lt;BR /&gt;
1. (?Pregular pattern here) is the format to extract a field &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;understand the regular expression [] syntax&lt;BR /&gt;&lt;BR /&gt;
e.g. [a-z]+ means any characters (one or more) that is from "a" to "z"&lt;BR /&gt;
[A-Z]+means any characters (one or more) that is from "A" to "Z"&lt;BR /&gt;
[0-9]+ means any numeric characters&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;the escape sequence in regex which is the "\". &lt;BR /&gt;
note \s means space&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;^ has double meaning - beginning of the line or if it is inside [], then it means any character that is NOT the next character. &lt;BR /&gt;
e.g [^\] means any character that is not your backslash&lt;BR /&gt;
[^.] means any character that is not a dot&lt;BR /&gt;
[^\s] means any character that is not a space&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;To make it easy, you can use the field extraction wizard from Splunk web but I found the generated regex inflexible and can't handle all the cases. I normally have to tweak the generated regex .&lt;/P&gt;

&lt;P&gt;Hope this helps. &lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 00:36:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-Want-to-start-after-the-and-collect-the-user-name/m-p/347388#M102883</guid>
      <dc:creator>erickyi</dc:creator>
      <dc:date>2017-11-02T00:36:06Z</dc:date>
    </item>
  </channel>
</rss>

