<?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 what does an empty line represent  in a regular expression? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/what-does-an-empty-line-represent-in-a-regular-expression/m-p/49091#M2685</link>
    <description>&lt;P&gt;I am looking to find a character (regular expression) in Splunk that searches for and returns values (from a file) starting with a word (ex.Total) and ending with a new empty line (representing a new paragraph etc..). &lt;/P&gt;

&lt;P&gt;An random text chosen from the web:&lt;/P&gt;

&lt;P&gt;A Memorandum of Understanding was signed by Total and MOGE on July 9, 1992. In addition to the construction of offshore gas facilities by the partners, a separate company in which PTT-EP, MOGE, and other affiliates of Total and Unocal are investors (the Moattama Gas Transportation Company - MGTC) built a 346-kilometer subsea pipeline to bring the gas to landfall in Myanmar, and a 63-kilometer onshore pipeline, with control and metering units, to carry the gas to the border with Thailand, which purchases most of the field's output under a long-term sales and purchase agreement.&lt;/P&gt;

&lt;P&gt;Construction was carried out between fall 1995 and mid-1998, with gas production beginning in July 1998. The total investment outlay was approximately US$1 billion. Further capital expenditure will be requiredduring the field's lifetime to drill additional wells and install compressors. The export production threshold of 525 million cubic feet per day was reached in early 2001.&lt;/P&gt;

&lt;P&gt;In this case, the regular expression would return the following: &lt;/P&gt;

&lt;P&gt;"Total and MOGE on July 9, 1992. In addition to the construction of offshore gas facilities by the partners, a separate company in which PTT-EP, MOGE, and other affiliates of Total and Unocal are investors (the Moattama Gas Transportation Company - MGTC) built a 346-kilometer subsea pipeline to bring the gas to landfall in Myanmar, and a 63-kilometer onshore pipeline, with control and metering units, to carry the gas to the border with Thailand, which purchases most of the field's output under a long-term sales and purchase agreement"&lt;/P&gt;

&lt;P&gt;To make it easier my text doesn't contain 7 consecutive empty spaces, you can look for a new line that contain 7 consecutive spaces at the beginning.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Aug 2013 06:18:08 GMT</pubDate>
    <dc:creator>royimad</dc:creator>
    <dc:date>2013-08-28T06:18:08Z</dc:date>
    <item>
      <title>what does an empty line represent  in a regular expression?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/what-does-an-empty-line-represent-in-a-regular-expression/m-p/49091#M2685</link>
      <description>&lt;P&gt;I am looking to find a character (regular expression) in Splunk that searches for and returns values (from a file) starting with a word (ex.Total) and ending with a new empty line (representing a new paragraph etc..). &lt;/P&gt;

&lt;P&gt;An random text chosen from the web:&lt;/P&gt;

&lt;P&gt;A Memorandum of Understanding was signed by Total and MOGE on July 9, 1992. In addition to the construction of offshore gas facilities by the partners, a separate company in which PTT-EP, MOGE, and other affiliates of Total and Unocal are investors (the Moattama Gas Transportation Company - MGTC) built a 346-kilometer subsea pipeline to bring the gas to landfall in Myanmar, and a 63-kilometer onshore pipeline, with control and metering units, to carry the gas to the border with Thailand, which purchases most of the field's output under a long-term sales and purchase agreement.&lt;/P&gt;

&lt;P&gt;Construction was carried out between fall 1995 and mid-1998, with gas production beginning in July 1998. The total investment outlay was approximately US$1 billion. Further capital expenditure will be requiredduring the field's lifetime to drill additional wells and install compressors. The export production threshold of 525 million cubic feet per day was reached in early 2001.&lt;/P&gt;

&lt;P&gt;In this case, the regular expression would return the following: &lt;/P&gt;

&lt;P&gt;"Total and MOGE on July 9, 1992. In addition to the construction of offshore gas facilities by the partners, a separate company in which PTT-EP, MOGE, and other affiliates of Total and Unocal are investors (the Moattama Gas Transportation Company - MGTC) built a 346-kilometer subsea pipeline to bring the gas to landfall in Myanmar, and a 63-kilometer onshore pipeline, with control and metering units, to carry the gas to the border with Thailand, which purchases most of the field's output under a long-term sales and purchase agreement"&lt;/P&gt;

&lt;P&gt;To make it easier my text doesn't contain 7 consecutive empty spaces, you can look for a new line that contain 7 consecutive spaces at the beginning.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2013 06:18:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/what-does-an-empty-line-represent-in-a-regular-expression/m-p/49091#M2685</guid>
      <dc:creator>royimad</dc:creator>
      <dc:date>2013-08-28T06:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: what does an empty line represent  in a regular expression?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/what-does-an-empty-line-represent-in-a-regular-expression/m-p/49092#M2686</link>
      <description>&lt;P&gt;I would probably go with "(?ms)(?&amp;lt;capture&amp;gt;Total.*)\n^\n"&lt;/P&gt;

&lt;P&gt;I haven't tested it, but the principle is: &lt;CODE&gt;(?ms)&lt;/CODE&gt; -- use both multiline and single line mode together. This allows . to match any character (including a newline), while allowing ^ and $ to reference beginning and ending of a line (as demarcated with newline characters).&lt;/P&gt;

&lt;P&gt;Next, start capturing with the word Total until you find a newline followed by a newline which is itself at the beginning of a line.&lt;/P&gt;

&lt;P&gt;The tester at &lt;A href="http://gskinner.com/RegExr/"&gt;http://gskinner.com/RegExr/&lt;/A&gt; suggests that (?ms)(?&amp;lt;capture&amp;gt;Total.*)^ might be enough.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2013 06:39:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/what-does-an-empty-line-represent-in-a-regular-expression/m-p/49092#M2686</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2013-08-28T06:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: what does an empty line represent  in a regular expression?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/what-does-an-empty-line-represent-in-a-regular-expression/m-p/49093#M2687</link>
      <description>&lt;P&gt;Hi Royimad,&lt;/P&gt;

&lt;P&gt;Have you tried &lt;A href="http://www.pythonregex.com/"&gt;http://www.pythonregex.com/&lt;/A&gt;? As Splunk is based on Python, I find this site really useful for testing regular expressions.&lt;/P&gt;

&lt;P&gt;Using this, the following regex gives you what you listed above:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;A Memorandum of Understanding was signed by (?P&amp;lt;blah&amp;gt;.*)\n\n
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The dot (.) won't match newline characters, so bounding the search with two \n's will ensure it breaks on a blank line.&lt;/P&gt;

&lt;P&gt;Hope this helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2013 06:40:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/what-does-an-empty-line-represent-in-a-regular-expression/m-p/49093#M2687</guid>
      <dc:creator>rturk</dc:creator>
      <dc:date>2013-08-28T06:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: what does an empty line represent  in a regular expression?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/what-does-an-empty-line-represent-in-a-regular-expression/m-p/49094#M2688</link>
      <description>&lt;P&gt;Thanks sowings for (?ms)(?&lt;CAPTURE&gt;Total.*)^ capturing my text.&lt;BR /&gt;
How about then having the Total number of lines ?&lt;/CAPTURE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2013 07:29:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/what-does-an-empty-line-represent-in-a-regular-expression/m-p/49094#M2688</guid>
      <dc:creator>royimad</dc:creator>
      <dc:date>2013-08-28T07:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: what does an empty line represent  in a regular expression?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/what-does-an-empty-line-represent-in-a-regular-expression/m-p/49095#M2689</link>
      <description>&lt;P&gt;do you think there are a reverse regular expression to capture text started by end line and ending with beginning of a character?&lt;/P&gt;

&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2013 08:58:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/what-does-an-empty-line-represent-in-a-regular-expression/m-p/49095#M2689</guid>
      <dc:creator>royimad</dc:creator>
      <dc:date>2013-08-28T08:58:34Z</dc:date>
    </item>
  </channel>
</rss>

