<?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 回复： Why does regex replacement not remove empty lines? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/752936#M93468</link>
    <description>&lt;P&gt;I used hex(t2) to see what was left in the string:&lt;/P&gt;
&lt;PRE&gt;...0A0D0A0D0AE69CACE7BD91E7AB99E59CA8E590AFE794A8204A
61766153637269707420E79A84E68385E586B5E4B88BE69588E69E
9CE69C80E4BDB3E380820D0A0D0A0D0A0D0A0D0A0D0A0D0A0D0A"&lt;/PRE&gt;
&lt;P&gt;The 0D0A pairs are CR LF pairs. \!n is JMP's escape for LF. I'd use this regex to match a run of any mix-and-match of CR and LF:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;t2 = Regex( t2, "[\n\r]+", "", globalreplace );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Regex does not use the ! in the escape.&lt;/P&gt;</description>
    <pubDate>Wed, 08 May 2024 14:28:01 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2024-05-08T14:28:01Z</dc:date>
    <item>
      <title>Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/752909#M93462</link>
      <description>&lt;P&gt;The purpose is to download web content, keep the visible content, and remove lines with only Spaces.&lt;BR /&gt;I use the following JSL but can't remove blank lines?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;u = "https://www.jmp.com/support/help/zh-cn/17.2/jmp/jsl-terminology.shtml";
txt = Load Text File( u );
a = Length( txt );
t1 = Regex( txt, "&amp;lt;(.[^&amp;gt;]{0,})&amp;gt;", "", globalreplace );
t2 = Regex( t1, "  ", "", globalreplace );
t2 = Regex( t2, "^( {0,})\!n", "", globalreplace );
t2 = Regex( t2, "\!n\!n", "", globalreplace );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 May 2024 14:00:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/752909#M93462</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-05-08T14:00:43Z</dc:date>
    </item>
    <item>
      <title>回复： Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/752920#M93463</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The same JSL can replace such empty lines, I do not know what went wrong?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;txt =
"--&amp;gt;\!n\!n\!n\!nJSL Terminology\!n\!n\!n\!n\!n\!n\!nScripting Guide &amp;gt; Introduction to Writing JSL Scripts &amp;gt; JSL Terminology";
t1 = Regex( txt, "\!n\!n+", "", globalreplace );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 May 2024 14:03:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/752920#M93463</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-05-08T14:03:27Z</dc:date>
    </item>
    <item>
      <title>回复： Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/752936#M93468</link>
      <description>&lt;P&gt;I used hex(t2) to see what was left in the string:&lt;/P&gt;
&lt;PRE&gt;...0A0D0A0D0AE69CACE7BD91E7AB99E59CA8E590AFE794A8204A
61766153637269707420E79A84E68385E586B5E4B88BE69588E69E
9CE69C80E4BDB3E380820D0A0D0A0D0A0D0A0D0A0D0A0D0A0D0A"&lt;/PRE&gt;
&lt;P&gt;The 0D0A pairs are CR LF pairs. \!n is JMP's escape for LF. I'd use this regex to match a run of any mix-and-match of CR and LF:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;t2 = Regex( t2, "[\n\r]+", "", globalreplace );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Regex does not use the ! in the escape.&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 14:28:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/752936#M93468</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2024-05-08T14:28:01Z</dc:date>
    </item>
    <item>
      <title>回复： Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/752938#M93469</link>
      <description>&lt;P&gt;...and typically, I'd replace runs of white space with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;t2 = Regex( t1, "[ \n\r]+", " ", globalreplace );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(a space is also in the character set, and the replacement is a space) to keep the output a little more like the input, with the runs of white space compressed to a single space. (I removed the other t2= statements as well.)&lt;/P&gt;
&lt;PRE&gt; &amp;amp;#32; Expression 2: Sum = 0; For( i = 1, i &amp;amp;lt;= 10, i++, 	Sum += i; 	Sh
ow( i, Sum ); ); You can format your script in any way that you like. However, th
e script editor can also format your script for you. The Scripting Guide uses th
e script editor’s default formatting for capitalization, spaces, returns, tabs, and s
o on. See Work with the Script Editor for more information about using the scri
pt editor. Note: The only white space exception is two-character operators (suc
h as &amp;amp;lt;= or ++). The operators cannot be separated by a space. 需要更多信
息？有问题？从 JMP 用户社区得到解答&amp;amp;#32;(community.jmp.com). 本网站在
启用 JavaScript 的情况下效果最佳。 ";&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 May 2024 14:37:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/752938#M93469</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2024-05-08T14:37:52Z</dc:date>
    </item>
    <item>
      <title>回复： Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/752941#M93471</link>
      <description>&lt;P&gt;or even this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;t2 = Regex( t1, "\s+", " ", globalreplace );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which uses regex "match any white space" \s which probably includes a few other characters like form-feed that are unlikely to occur.&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 14:43:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/752941#M93471</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2024-05-08T14:43:33Z</dc:date>
    </item>
    <item>
      <title>回复： Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753103#M93494</link>
      <description>&lt;P&gt;Thank Craige!&lt;/P&gt;&lt;P&gt;Your help helped me further learn how JMP handles regex.Thank you so much for your time!&lt;BR /&gt;But the complicated ones don't:&lt;BR /&gt;For example, this JSL download txt&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20240509151922.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64042i434F991E072B66F0/image-size/large?v=v2&amp;amp;px=999" role="button" title="20240509151922.png" alt="20240509151922.png" /&gt;&lt;/span&gt;&lt;BR /&gt;How can I match &amp;lt;"&amp;gt;JSLString"&amp;gt; across multiple lines before the first &amp;lt;/p&amp;gt;?&lt;BR /&gt;Replace it with something like this.txt has many places like this, need to use JSL implementation.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-05-09_15-21-18.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64043iBC10B28F8A0D7043/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-05-09_15-21-18.png" alt="2024-05-09_15-21-18.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 07:23:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753103#M93494</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-05-09T07:23:38Z</dc:date>
    </item>
    <item>
      <title>回复： Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753105#M93495</link>
      <description>&lt;UL&gt;&lt;LI&gt;&lt;P class=""&gt;I tried EmEditor can implement. But JSL's did not succeed.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks Experts!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-05-09_15-28-54.png" style="width: 988px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64044iDCCB23A60F70D448/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-05-09_15-28-54.png" alt="2024-05-09_15-28-54.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 07:32:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753105#M93495</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-05-09T07:32:41Z</dc:date>
    </item>
    <item>
      <title>回复： Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753106#M93496</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;JSLString.+?&amp;lt;/p&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 May 2024 07:33:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753106#M93496</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-05-09T07:33:43Z</dc:date>
    </item>
    <item>
      <title>回复： Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753142#M93498</link>
      <description>&lt;P&gt;That looks like it should work. I'd need a complete example to understand what it is doing.&lt;/P&gt;
&lt;P&gt;The JSL regex function . (period) always matches a newline, or any other character. + (plus) means repeat the . one or more times.&lt;/P&gt;
&lt;P&gt;The reason you want to use .+? is to reluctantly(as few as possible) match one or more characters. Without the ? (question mark) the .+ would be greedy(as many as possible) and probably skip forward too far.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 13:44:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753142#M93498</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2024-05-09T13:44:46Z</dc:date>
    </item>
    <item>
      <title>回复： Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753166#M93499</link>
      <description>&lt;P&gt;Thank Craige!&lt;/P&gt;&lt;P&gt;I want to capture and automatically translate JMP online help content about JSL into Chinese.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;		u = "https://www.jmp.com/support/help/zh-cn/17.2/#page/jmp/jsl-terminology.shtml";
		txt = Load Text File( u );
		t1 = Regex( txt, "&amp;lt;(.[^&amp;gt;]{0,})&amp;gt;", "", globalreplace );
		t2 = Regex( t1, "[ \n\r][ \n\r]+", "\!n  ", globalreplace );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;However, the section about JSL code in the help document does not need to be translated, want to use the keyword&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-05-09_22-10-00.png" style="width: 975px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64059i28AE615C38B75853/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-05-09_22-10-00.png" alt="2024-05-09_22-10-00.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"JSLOperatorName" in the web source code, and the first &amp;lt;/p&amp;gt; after it to mark the scope of the code that does not need to be translated.&lt;BR /&gt;Since sections of JSL code on the same page may span multiple lines, JSL regex is used to automatically recognize tags.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-05-09_22-11-18.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64061iF37D836D52E1530C/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-05-09_22-11-18.png" alt="2024-05-09_22-11-18.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 14:15:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753166#M93499</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-05-09T14:15:58Z</dc:date>
    </item>
    <item>
      <title>回复： Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753180#M93500</link>
      <description>&lt;P class=""&gt;&lt;SPAN class=""&gt;The underlying knowledge of regular expressions is still difficult to understand.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Thanks for the expert's help.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 14:22:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753180#M93500</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-05-09T14:22:53Z</dc:date>
    </item>
    <item>
      <title>回复： Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753187#M93501</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6878"&gt;@Jeff_Perkinson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The site is sending you an "unsupported browser" page rather than the data you are expecting (your new link is slightly different).&lt;/P&gt;
&lt;P&gt;Talk with the JMP sales team about your needs. I believe some documentation is already translated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;u = "https://www.jmp.com/support/help/zh-cn/17.2/jmp/jsl-terminology.shtml";
txt = Load Text File( u );
regexmatch(txt,"JSLString.+?&amp;lt;/p&amp;gt;")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;{&lt;BR /&gt;"JSLString\!"&amp;gt;\!"Hello, World\!"&amp;lt;/span&amp;gt;;&amp;lt;/pre&amp;gt;&lt;BR /&gt;&amp;lt;pre id=\!"ww220404\!" class=\!"code\!"&amp;gt;&amp;lt;span class=\!"JSLOperatorName\!"&amp;gt;Show&amp;lt;/span&amp;gt;( A );&amp;lt;/pre&amp;gt;&lt;BR /&gt;&amp;lt;p id=\!"ww220406\!" class=\!"codeOutput\!"&amp;gt;A = \!"Hello, World\!";&amp;lt;/p&amp;gt;"&lt;BR /&gt;}&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 15:36:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753187#M93501</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2024-05-09T15:36:10Z</dc:date>
    </item>
    <item>
      <title>回复： Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753374#M93516</link>
      <description>&lt;P&gt;Thank Craige!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Yes, most of the help documentation for JMP has been translated.&lt;/SPAN&gt;&lt;SPAN class=""&gt;However, the Script and JSL parts are not translated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;If use Google Translate, the JSL code content inside will also be translated, and do not use reading.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Thanks again to the experts!&lt;/SPAN&gt;&lt;SPAN class=""&gt;Thanks to the JMP team!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 23:10:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753374#M93516</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-05-09T23:10:23Z</dc:date>
    </item>
    <item>
      <title>回复： Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753440#M93522</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;Go ahead and ask the experts: Can "regexmatch" add global parameters like "globalreplace"?&lt;/SPAN&gt;&lt;SPAN class=""&gt;Enables multiple segments of content in different locations to be extracted at once.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank Craige!&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 14:23:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753440#M93522</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-05-10T14:23:14Z</dc:date>
    </item>
    <item>
      <title>回复： Why does regex replacement not remove empty lines?</title>
      <link>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753530#M93530</link>
      <description>&lt;P&gt;No, and maybe yes.&lt;/P&gt;
&lt;P&gt;&lt;LI-MESSAGE title="Add flag to Regex Match() to find all non-overlapping occurances of pattern" uid="582080" url="https://community.jmp.com/t5/JMP-Wish-List/Add-flag-to-Regex-Match-to-find-all-non-overlapping-occurances/m-p/582080#U582080" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-MESSAGE title="Regex: add options for all flags" uid="687607" url="https://community.jmp.com/t5/JMP-Wish-List/Regex-add-options-for-all-flags/m-p/687607#U687607" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use regex inside a pattern match to do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;u = "https://www.jmp.com/support/help/zh-cn/17.2/jmp/jsl-terminology.shtml";
txt = Load Text File( u );
matches = {}; // record matches here
rc = Pat Match(
	txt,
	Pat Repeat(
		Pat Pos() &amp;gt;&amp;gt; pos// remember the pos just before JSLString text
		+ Pat Regex( "JSLString.+?&amp;lt;/p&amp;gt;" ) &amp;gt;&amp;gt; str// keep the matched text in str
		+ Pat Test( // use the test to inject some JSL into the matcher
			matches[nitems(matches)+1] = Eval List( {pos, str} ); // record the match
			1; // the "test" succeeds
		) + Pat Arb() // skip over more and more arbitrary text
	) + Pat R Pos( 0 ) // make sure reach the end
);
Show( rc, nitems(matches) );
For( i = 1, i &amp;lt;= nitems(matches), i += 1,
	Show( i, matches[i] )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also, your regex does not really match the HTML. It will miss some and combine some. HTML is not the proper markup for reworking the text. The above finds 2 of 3 matches on the page (combining 2 and 3 into the 2nd) because the &amp;lt;/p&amp;gt; does not happen between 2 and 3.&lt;/P&gt;
&lt;PRE&gt;rc = 1;
N Items(matches) = 2;
...first match...
i = 1;
matches[i] = {8591, "JSLString\!"&amp;gt;\!"Hello, World\!"&amp;lt;/span&amp;gt;;&amp;lt;/pre&amp;gt;
          &amp;lt;pre id=\!"ww220404\!" class=\!"code\!"&amp;gt;&amp;lt;span class=\!"JSLOperatorName\!"&amp;gt;Show&amp;lt;/span&amp;gt;( A );&amp;lt;/pre&amp;gt;
          &amp;lt;p id=\!"ww220406\!" class=\!"codeOutput\!"&amp;gt;A = \!"Hello, World\!";&amp;lt;/p&amp;gt;"};
... second match...
i = 2;
matches[i] = {10559, "JSLString\!"&amp;gt;\!"My Line Graph\!"&amp;lt;/span&amp;gt; ),&amp;lt;/pre&amp;gt;
          &amp;lt;pre id=\!"ww229621\!" class=\!"code\!"&amp;gt;		Frame Size( &amp;lt;span class=\!"JSLNumber\!"&amp;gt;300&amp;lt;/span&amp;gt;, &amp;lt;span class=\!"JSLNumber\!"&amp;gt;500&amp;lt;/span&amp;gt; ),&amp;lt;/pre&amp;gt;
          &amp;lt;pre id=\!"ww229622\!" class=\!"code\!"&amp;gt;		&amp;lt;span class=\!"JSLOperatorName\!"&amp;gt;Marker&amp;lt;/span&amp;gt;( &amp;lt;span class=\!"JSLOperatorName\!"&amp;gt;Marker State&amp;lt;/span&amp;gt;( &amp;lt;span class=\!"JSLNumber\!"&amp;gt;3&amp;lt;/span&amp;gt; ), [&amp;lt;span class=\!"JSLNumber\!"&amp;gt;11&amp;lt;/span&amp;gt; &amp;lt;span class=\!"JSLNumber\!"&amp;gt;44&amp;lt;/span&amp;gt; &amp;lt;span class=\!"JSLNumber\!"&amp;gt;77&amp;lt;/span&amp;gt;], [&amp;lt;span class=\!"JSLNumber\!"&amp;gt;75&amp;lt;/span&amp;gt; &amp;lt;span class=\!"JSLNumber\!"&amp;gt;25&amp;lt;/span&amp;gt; &amp;lt;span class=\!"JSLNumber\!"&amp;gt;50&amp;lt;/span&amp;gt;] );&amp;lt;/pre&amp;gt;
          &amp;lt;pre id=\!"ww229623\!" class=\!"code\!"&amp;gt;		&amp;lt;span class=\!"JSLOperatorName\!"&amp;gt;Pen Color&amp;lt;/span&amp;gt;( &amp;lt;span 
...there was no &amp;lt;p&amp;gt;, so the second match continues...
class=\!"JSLString\!"&amp;gt;\!"Blue\!" &amp;lt;/span&amp;gt;);&amp;lt;/pre&amp;gt;
          &amp;lt;pre id=\!"ww229612\!" class=\!"code\!"&amp;gt;		&amp;lt;span class=\!"JSLOperatorName\!"&amp;gt;Line&amp;lt;/span&amp;gt;( [&amp;lt;span class=\!"JSLNumber\!"&amp;gt;10 30 70&amp;lt;/span&amp;gt;], [&amp;lt;span class=\!"JSLNumber\!"&amp;gt;88 22 44&amp;lt;/span&amp;gt;] ));&amp;lt;/pre&amp;gt;
          &amp;lt;p id=\!"ww236173\!" class=\!"body\!"&amp;gt;Note that the &amp;lt;span class=\!"code\!"&amp;gt;Frame Size()&amp;lt;/span&amp;gt; arguments &amp;lt;span class=\!"code\!"&amp;gt;300&amp;lt;/span&amp;gt; and &amp;lt;span class=\!"code\!"&amp;gt;500&amp;lt;/span&amp;gt; are not named. The position of these arguments implies meaning; the first argument is always the width, the second argument is always the height.&amp;lt;/p&amp;gt;"};&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 23:45:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Why-does-regex-replacement-not-remove-empty-lines/m-p/753530#M93530</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2024-05-10T23:45:43Z</dc:date>
    </item>
  </channel>
</rss>

