<?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: How do replace these with JSL with regex substitution? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685366#M87138</link>
    <description>&lt;P&gt;EmEditor's jsees&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-10-10_14-52-13.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57335i191EFA8CA5FDEF8D/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-10-10_14-52-13.png" alt="2023-10-10_14-52-13.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;document.selection.Replace("POST (.[^ ]{0,}) HTTP\\/1\\.1","u=\"\\1\";h=[=&amp;gt;];",eeReplaceAll | eeFindReplaceRegExp,0);
document.selection.Replace("^(.{0,}): (.{0,})$","h[\"\\1\"]=\"\\2\";",eeReplaceAll | eeFindReplaceRegExp,0);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 10 Oct 2023 06:54:18 GMT</pubDate>
    <dc:creator>lala</dc:creator>
    <dc:date>2023-10-10T06:54:18Z</dc:date>
    <item>
      <title>How do replace these with JSL with regex substitution?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685242#M87118</link>
      <description>&lt;P&gt;This is copied in the browser. How to use JSL's regular substitution is processed into syntactic JSL with the following requirements:&lt;BR /&gt;1, contains POST......HTTP/1.1 replaced with: u="...";h=[=&amp;gt;];&lt;BR /&gt;2, containing:, write h&lt;BR /&gt;3. The last line..., replace with: jj="...";rs=New HTTP Request(URL(u),Method("POST"),JSON(jj),Headers(h));&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;POST https://app.com/w1/api HTTP/1.1
Host: apparticle.longhuvip.com
Connection: keep-alive
Content-Length: 87
Accept: application/json, text/javascript, */*; q=0.01
Origin: https://app.com
User-Agent: Mozilla/5.0 (Linux); 5.11.0.6
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: https://appp.com/w33/community/refreshKey=1696089600
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,en-US;q=0.8
X-Requested-With: com.aiyu.kaipanla

c=ForumsMsgJX&amp;amp;a=GetInfo&amp;amp;MsgID=30927&amp;amp;Tag=1&amp;amp;DeviceID=ffffffff-e4d8-03bc-ffff-ffffb561792e&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Oct 2023 03:48:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685242#M87118</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-10T03:48:03Z</dc:date>
    </item>
    <item>
      <title>回复： How do replace these with JSL with regular substitution?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685246#M87119</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-10-10_9-08-04.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57322i12081980A0C3F1EB/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-10-10_9-08-04.png" alt="2023-10-10_9-08-04.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;u="https://app.com/w1/api";h=[=&amp;gt;];
h["Host"]="apparticle.longhuvip.com";
h["Connection"]="keep-alive";
h["Content-Length"]="87";
h["Accept"]="application/json, text/javascript, */*; q=0.01";
h["User-Agent"]="Mozilla/5.0 (Linux); 5.11.0.6";
h["Content-Type"]="application/x-www-form-urlencoded; charset=UTF-8";
h["Accept-Encoding"]="gzip, deflate";
h["Accept-Language"]="zh-CN,en-US;q=0.8";
h["X-Requested-With"]="com.aiyu.kaipanla";

jj="c=ForumsMsgJX&amp;amp;a=GetInfo&amp;amp;MsgID=30927&amp;amp;Tag=1&amp;amp;DeviceID=ffffffff-e4d8-03bc-ffff-ffffb561792e";
rs=New HTTP Request(URL(u),Method("POST"),JSON(jj),Headers(h));
rr=rs&amp;lt;&amp;lt;Send;txt=blobtochar(Gzip Uncompress(rr));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Oct 2023 01:21:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685246#M87119</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-10T01:21:24Z</dc:date>
    </item>
    <item>
      <title>回复： How do replace these with JSL with regular substitution?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685270#M87123</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;text=Get Clipboard();
txt = Regex(text, "^POST (.+?) HTTP\/1.1\!n", "u=\!"\1\!";h=[=&amp;gt;];");
txt = Substitute(text, "^(.+?): (.+?)\!n", "h[\!"\1\!"]=\!"\2\!";");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;？？&lt;/P&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="2023-10-10_11-42-00.png" style="width: 211px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57325iF557F890EEA3F97E/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-10-10_11-42-00.png" alt="2023-10-10_11-42-00.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 03:42:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685270#M87123</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-10T03:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do replace these with JSL with regex substitution?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685320#M87128</link>
      <description>&lt;P&gt;I would use Words() and split it so I have each of the lines as its own item in a list. Then I would loop over those and build the associative array as I go. Split on ":", first part as key and second as value (format as needed). Last line I would ignore in the loop and build separately&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 04:35:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685320#M87128</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-10T04:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do replace these with JSL with regex substitution?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685325#M87130</link>
      <description>&lt;UL&gt;&lt;LI&gt;&lt;P class=""&gt;Thanks jthi! Can you provide JSL? I can only use EmEditor.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Tue, 10 Oct 2023 05:19:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685325#M87130</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-10T05:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do replace these with JSL with regex substitution?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685329#M87132</link>
      <description>&lt;P&gt;This might give some idea&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

aa_headers = Associative Array();

str = "POST https://app.com/w1/api HTTP/1.1
Host: apparticle.longhuvip.com
Connection: keep-alive";



For Each({line}, Words(str, "\!N"),
	rgx_match = Regex(line, "^.*?: ");
	If(!IsMissing(rgx_match), // not the most robust
		aa_headers[Word(1, line, ":")] = Substitute(line, rgx_match, "");
	);
);

show(aa_headers);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;creating a list of possible keys for associative array is most likely more robust if it stays the same&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 05:29:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685329#M87132</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-10T05:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do replace these with JSL with regex substitution?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685335#M87133</link>
      <description>&lt;UL&gt;&lt;LI&gt;&lt;P class=""&gt;Continue asking: How can I get the total number of str lines?&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks Experts!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;str = "POST https://app.com/w1/api HTTP/1.1
Host: apparticle.longhuvip.com
Connection: keep-alive";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Oct 2023 06:27:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685335#M87133</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-10T06:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do replace these with JSL with regex substitution?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685357#M87135</link>
      <description>&lt;P&gt;Scripting index&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1696919659774.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57331iFCCC38B917ED6294/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1696919659774.png" alt="jthi_0-1696919659774.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and JMP documentation&amp;nbsp;&lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/list-functions.shtml?os=win&amp;amp;source=application#ww5017432" target="_blank" rel="noopener"&gt;N Items()&lt;/A&gt;&amp;nbsp;has the information for you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 06:34:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685357#M87135</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-10T06:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do replace these with JSL with regex substitution?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685364#M87137</link>
      <description>&lt;UL&gt;&lt;LI&gt;&lt;P class=""&gt;I still don't get it.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-10-10_14-42-44.png" style="width: 572px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57334i772BFFD9D340D10A/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-10-10_14-42-44.png" alt="2023-10-10_14-42-44.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 06:47:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685364#M87137</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-10T06:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do replace these with JSL with regex substitution?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685366#M87138</link>
      <description>&lt;P&gt;EmEditor's jsees&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-10-10_14-52-13.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57335i191EFA8CA5FDEF8D/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-10-10_14-52-13.png" alt="2023-10-10_14-52-13.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;document.selection.Replace("POST (.[^ ]{0,}) HTTP\\/1\\.1","u=\"\\1\";h=[=&amp;gt;];",eeReplaceAll | eeFindReplaceRegExp,0);
document.selection.Replace("^(.{0,}): (.{0,})$","h[\"\\1\"]=\"\\2\";",eeReplaceAll | eeFindReplaceRegExp,0);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Oct 2023 06:54:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685366#M87138</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-10T06:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do replace these with JSL with regex substitution?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685367#M87139</link>
      <description>&lt;P&gt;What do you need the item count for? Str is a string, not a list so you cannot use N Items on it (you need to use the splitter version which you get using Words()).&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 06:58:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685367#M87139</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-10T06:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do replace these with JSL with regex substitution?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685370#M87140</link>
      <description>&lt;UL&gt;&lt;LI&gt;&lt;P class=""&gt;Thank you. I just wanted a different substitution in the last line&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Tue, 10 Oct 2023 07:02:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-replace-these-with-JSL-with-regex-substitution/m-p/685370#M87140</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-10T07:02:24Z</dc:date>
    </item>
  </channel>
</rss>

