<?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 extraction with dashes in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/Regex-extraction-with-dashes/m-p/564055#M8481</link>
    <description>&lt;LI-CODE lang="markup"&gt;(?&amp;lt;=-\s)(?&amp;lt;rule_name&amp;gt;[^-]+-[^-]+)(?=-)&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 20 Aug 2021 08:55:29 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-08-20T08:55:29Z</dc:date>
    <item>
      <title>Regex extraction with dashes</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Regex-extraction-with-dashes/m-p/564051#M8479</link>
      <description>&lt;P&gt;Hi folks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's been a while since i posted here, but it looks like I'm stuck a bit (again!)&lt;/P&gt;&lt;P&gt;I'm trying to exclude a prefix and suffix from my results, which are separated from the main string by a dash "-" .&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue I have that some of the words in my string also contain -'s.&lt;/P&gt;&lt;P&gt;e.g. "Access - My string - July - Splunk" , so the data I'd like to show as my resuls is only&amp;nbsp;&lt;STRONG&gt;My string - July.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I came up with this:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;| rex field=rule_name max_match=0 "(?&amp;lt;=-\s)(?&amp;lt;rule_name&amp;gt;[^-]+)(?=-)"&lt;BR /&gt;| rex field=rule_name mode=sed "s/^s/s/g"&lt;BR /&gt;| rex field=rule_name mode=sed "s/\s$//g"&lt;BR /&gt;&lt;BR /&gt;But then my result shows in 2 separate lines like this:&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;My string&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;July&lt;/STRONG&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tips and hints on how to make them appear in one line?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; !&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 08:47:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Regex-extraction-with-dashes/m-p/564051#M8479</guid>
      <dc:creator>klaudiac</dc:creator>
      <dc:date>2021-08-20T08:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Regex extraction with dashes</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Regex-extraction-with-dashes/m-p/564054#M8480</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223748"&gt;@klaudiac&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if you want to extract the string between the first and the last dash, you could use the following regex&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;-(?&amp;lt;my_field&amp;gt;.*)\s+-&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/ag9Q9b/1" target="_blank"&gt;https://regex101.com/r/ag9Q9b/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you can share more samples of your logs I could be more precise.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 08:52:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Regex-extraction-with-dashes/m-p/564054#M8480</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-08-20T08:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: Regex extraction with dashes</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Regex-extraction-with-dashes/m-p/564055#M8481</link>
      <description>&lt;LI-CODE lang="markup"&gt;(?&amp;lt;=-\s)(?&amp;lt;rule_name&amp;gt;[^-]+-[^-]+)(?=-)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 20 Aug 2021 08:55:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Regex-extraction-with-dashes/m-p/564055#M8481</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-08-20T08:55:29Z</dc:date>
    </item>
  </channel>
</rss>

