<?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: Rex to extract string with words and characters in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-extract-string-with-words-and-characters/m-p/671318#M230072</link>
    <description>&lt;P&gt;Dear Splunk new learners...&amp;nbsp;&lt;BR /&gt;&lt;A href="https://www.youtube.com/@siemnewbies101/playlists" target="_blank"&gt;https://www.youtube.com/@siemnewbies101/playlists&lt;/A&gt;&lt;/P&gt;&lt;P&gt;the primary objective of this youtube channel is to teach Splunk newbies / new learners the SPL commands and most importantly the regular expressions. pls check it out, thanks.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Dec 2023 21:55:52 GMT</pubDate>
    <dc:creator>inventsekar</dc:creator>
    <dc:date>2023-12-08T21:55:52Z</dc:date>
    <item>
      <title>Rex to extract string with words and characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-extract-string-with-words-and-characters/m-p/671276#M230059</link>
      <description>&lt;P&gt;Looking for help with this rex command. I want to capture the continuous string after "invalid user" whether it has special characters or not. Here are some examples from my data set (abc is just an example, it could be any word or character)&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;invalid user abc&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;invalid user abc@def&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;invalid user $abc&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;invalid user abc\def&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;invalid user abc-def&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;If I run the below, I am able to successfully extract the invaliduser if it is a word. But this does not work if there is a special character&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;base search&amp;nbsp;| rex "invalid user (?&amp;lt;invaliduser&amp;gt;\w+) "&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I have figured out how to extract if there is a leading special character (W+\w+) or a special character in the middle (w+\W+\w+) but those aren't exactly what I'm looking for.&lt;/P&gt;&lt;P&gt;Is there a single rex command I can use to capture all possible results?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 15:58:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-to-extract-string-with-words-and-characters/m-p/671276#M230059</guid>
      <dc:creator>AK89</dc:creator>
      <dc:date>2023-12-08T15:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Rex to extract string with words and characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-extract-string-with-words-and-characters/m-p/671279#M230060</link>
      <description>&lt;P&gt;If the string ends with a space then you can extract it using this command&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "invalid user (?&amp;lt;invaliduser&amp;gt;\S+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it ends with a comma or other character not part of the string then this command should do it&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "invalid user (?&amp;lt;invaliduser&amp;gt;[^,]+)"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 08 Dec 2023 16:14:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-to-extract-string-with-words-and-characters/m-p/671279#M230060</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-12-08T16:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Rex to extract string with words and characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-extract-string-with-words-and-characters/m-p/671280#M230061</link>
      <description>&lt;P&gt;That's exactly what I needed. Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 16:17:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-to-extract-string-with-words-and-characters/m-p/671280#M230061</guid>
      <dc:creator>AK89</dc:creator>
      <dc:date>2023-12-08T16:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Rex to extract string with words and characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-extract-string-with-words-and-characters/m-p/671318#M230072</link>
      <description>&lt;P&gt;Dear Splunk new learners...&amp;nbsp;&lt;BR /&gt;&lt;A href="https://www.youtube.com/@siemnewbies101/playlists" target="_blank"&gt;https://www.youtube.com/@siemnewbies101/playlists&lt;/A&gt;&lt;/P&gt;&lt;P&gt;the primary objective of this youtube channel is to teach Splunk newbies / new learners the SPL commands and most importantly the regular expressions. pls check it out, thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 21:55:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-to-extract-string-with-words-and-characters/m-p/671318#M230072</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2023-12-08T21:55:52Z</dc:date>
    </item>
  </channel>
</rss>

