<?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 you replace square brackets &amp;quot;[&amp;quot; &amp;quot;]&amp;quot; in a string with Regex? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-you-replace-square-brackets-quot-quot-quot-quot-in-a/m-p/263979#M51506</link>
    <description>&lt;P&gt;maybe&amp;nbsp;&lt;LI-MESSAGE title="Regex issue with escaped characters" uid="79540" url="https://community.jmp.com/t5/Discussions/Regex-issue-with-escaped-characters/m-p/79540#U79540" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are probably fighting JMP's escaping getting mixed up with regex escaping&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/12269"&gt;@paul_vezzetti&lt;/a&gt;&amp;nbsp;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;JMP strings make a special case of \[ and ]\ &lt;EM&gt;anywhere&lt;/EM&gt; in a JMP string to turn off JMP's escaping.&lt;/P&gt;&lt;P&gt;try \!\[ and just use a bare ] . Regex should not need to escape the ] unless it is in a [character class].&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;regex("[1 2 3]","\!\[(.*)]","\1")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;"1 2 3"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;\!\ is JMP's escape to make a literal backslash. Regex then sees the \[ and behaves as expected.&lt;/P&gt;&lt;P&gt;Alternatively, you could use the \[ ... ]\ , but it creates worse problems if you actually need ]\ in the regex and seems less clear:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;regex("[1 2 3]","\[\[(.*)]]\","\1")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I hope JMP gets a regex-quoted string to solve this double escaping issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 May 2020 01:51:33 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2020-05-04T01:51:33Z</dc:date>
    <item>
      <title>How do you replace square brackets "[" "]" in a string with Regex?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-you-replace-square-brackets-quot-quot-quot-quot-in-a/m-p/263954#M51505</link>
      <description>&lt;P&gt;I know that [ and ] are special characters in regular expressions, but I can't figure the right escape string to be able to treat them as a specific character in a pattern string.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to do, as an example, is convert "[1 1 1]" to "1 1 1".&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2020 00:48:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-you-replace-square-brackets-quot-quot-quot-quot-in-a/m-p/263954#M51505</guid>
      <dc:creator>MathStatChem</dc:creator>
      <dc:date>2020-05-04T00:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do you replace square brackets "[" "]" in a string with Regex?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-you-replace-square-brackets-quot-quot-quot-quot-in-a/m-p/263979#M51506</link>
      <description>&lt;P&gt;maybe&amp;nbsp;&lt;LI-MESSAGE title="Regex issue with escaped characters" uid="79540" url="https://community.jmp.com/t5/Discussions/Regex-issue-with-escaped-characters/m-p/79540#U79540" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are probably fighting JMP's escaping getting mixed up with regex escaping&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/12269"&gt;@paul_vezzetti&lt;/a&gt;&amp;nbsp;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;JMP strings make a special case of \[ and ]\ &lt;EM&gt;anywhere&lt;/EM&gt; in a JMP string to turn off JMP's escaping.&lt;/P&gt;&lt;P&gt;try \!\[ and just use a bare ] . Regex should not need to escape the ] unless it is in a [character class].&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;regex("[1 2 3]","\!\[(.*)]","\1")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;"1 2 3"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;\!\ is JMP's escape to make a literal backslash. Regex then sees the \[ and behaves as expected.&lt;/P&gt;&lt;P&gt;Alternatively, you could use the \[ ... ]\ , but it creates worse problems if you actually need ]\ in the regex and seems less clear:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;regex("[1 2 3]","\[\[(.*)]]\","\1")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I hope JMP gets a regex-quoted string to solve this double escaping issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2020 01:51:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-you-replace-square-brackets-quot-quot-quot-quot-in-a/m-p/263979#M51506</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2020-05-04T01:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do you replace square brackets "[" "]" in a string with Regex?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-you-replace-square-brackets-quot-quot-quot-quot-in-a/m-p/264077#M51518</link>
      <description>&lt;P&gt;For something that simple can't you just use substitute?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a = "[1 1 1]";
b = substitute(a, "[", "", "]", "");
show(b);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;"1 1 1"&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 May 2020 14:48:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-you-replace-square-brackets-quot-quot-quot-quot-in-a/m-p/264077#M51518</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2020-05-04T14:48:20Z</dc:date>
    </item>
  </channel>
</rss>

