<?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: JSL Regular substitution: Replaces the same line | and the following characters with null in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-Regular-substitution-Replaces-the-same-line-and-the/m-p/751834#M93304</link>
    <description>&lt;P&gt;Thanks!&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P class=""&gt;I prefer to use regular.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;mystr = "\[BPS&amp;lt;4.05|is Missing(BPS)
BPS&amp;gt;=2.75
ab&amp;gt;=1961734|is Missing(ab)
efg&amp;lt;13741
]\";

t1=Regex(mystr,"\|(.[^)]{0,})\)","",globalreplace);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 03 May 2024 06:52:15 GMT</pubDate>
    <dc:creator>lala</dc:creator>
    <dc:date>2024-05-03T06:52:15Z</dc:date>
    <item>
      <title>JSL Regular substitution: Replaces the same line | and the following characters with null</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Regular-substitution-Replaces-the-same-line-and-the/m-p/751818#M93299</link>
      <description>&lt;P class=""&gt;&lt;SPAN class=""&gt;Such as&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;BPS&amp;lt;4.05|is Missing(BPS)
BPS&amp;gt;=2.75
ab&amp;gt;=1961734|is Missing(ab)
efg&amp;lt;13741&lt;/CODE&gt;&lt;/PRE&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;to&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;BPS&amp;lt;4.05
BPS&amp;gt;=2.75
ab&amp;gt;=1961734
efg&amp;lt;13741&lt;/CODE&gt;&lt;/PRE&gt;&lt;P class=""&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 03:57:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Regular-substitution-Replaces-the-same-line-and-the/m-p/751818#M93299</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-05-03T03:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Regular substitution: Replaces the same line | and the following characters with null</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Regular-substitution-Replaces-the-same-line-and-the/m-p/751829#M93300</link>
      <description>&lt;P&gt;There isn't a need to use Regexes for this, Words + Word should be enough&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

mystr = "\[BPS&amp;lt;4.05|is Missing(BPS)
BPS&amp;gt;=2.75
ab&amp;gt;=1961734|is Missing(ab)
efg&amp;lt;13741
]\";

mylist = Words(mystr, "\!N");

comparisons = Transform Each({line}, mylist,
	Word(1, line, "|");
);

result = Concat Items(comparisons, "\!N");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 May 2024 04:33:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Regular-substitution-Replaces-the-same-line-and-the/m-p/751829#M93300</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-05-03T04:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Regular substitution: Replaces the same line | and the following characters with null</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Regular-substitution-Replaces-the-same-line-and-the/m-p/751834#M93304</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P class=""&gt;I prefer to use regular.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;mystr = "\[BPS&amp;lt;4.05|is Missing(BPS)
BPS&amp;gt;=2.75
ab&amp;gt;=1961734|is Missing(ab)
efg&amp;lt;13741
]\";

t1=Regex(mystr,"\|(.[^)]{0,})\)","",globalreplace);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 May 2024 06:52:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Regular-substitution-Replaces-the-same-line-and-the/m-p/751834#M93304</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-05-03T06:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Regular substitution: Replaces the same line | and the following characters with null</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Regular-substitution-Replaces-the-same-line-and-the/m-p/751934#M93322</link>
      <description>&lt;P&gt;It can also be a good option. Sometimes regex patterns are difficult to understand and you can end up with difficult patterns (especially if you have corner cases) but it is very flexible&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

rgx_parse = function({str}, {Default Local},
	// new_str = Regex(str, "\|.+?\)", "", GLOBALREPLACE);
	new_str = Regex(str, "\|(.[^)]{0,})\)", "", GLOBALREPLACE);
	
	return(new_str);
);

words_parse = function({str}, {Default Local},
	mylist = Words(str, "\!N");

	comparisons = Transform Each({line}, mylist,
		Word(1, line, "|");
	);

	result = Concat Items(comparisons, "\!N");
);

mystr1 = "\[BPS&amp;lt;4.05|is Missing(BPS)
BPS&amp;gt;=2.75
ab&amp;gt;=1961734|is Missing(ab)
efg&amp;lt;13741
]\";

mystr2 = "\[BPS&amp;lt;4.05|is Missing(BPS)
BPS&amp;gt;=2.75|
ab&amp;gt;=1961734|is Missing(ab)
efg&amp;lt;13741
]\";

mystr3 = "\[BPS&amp;lt;4.05|is Missing(BPS)
BPS&amp;gt;=2.75|)abc
ab&amp;gt;=1961734|is Missing(ab)
efg&amp;lt;13741
]\";


Show(rgx_parse(mystr1));
Show(words_parse(mystr1));
write("\!N");

Show(rgx_parse(mystr2));
Show(words_parse(mystr2));
write("\!N");

Show(rgx_parse(mystr3));
Show(words_parse(mystr3));
write("\!N");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 12:36:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Regular-substitution-Replaces-the-same-line-and-the/m-p/751934#M93322</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-05-03T12:36:47Z</dc:date>
    </item>
  </channel>
</rss>

