<?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 How to get characters between brackets within a string?? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-get-characters-between-brackets-within-a-string/m-p/558990#M77221</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a string like below "&amp;nbsp;[CDO600705010] [S 88ABCV A B IT] [C23204348IT] "&lt;/P&gt;&lt;P&gt;Do you know how to get characters between open and close bracket&lt;/P&gt;&lt;P&gt;For instance:&lt;/P&gt;&lt;P&gt;CDO600705010&lt;/P&gt;&lt;P&gt;S 88ABCV A B IT&lt;/P&gt;&lt;P&gt;C23204348IT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sincerely&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 16:00:44 GMT</pubDate>
    <dc:creator>PhamBao</dc:creator>
    <dc:date>2023-06-09T16:00:44Z</dc:date>
    <item>
      <title>How to get characters between brackets within a string??</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-characters-between-brackets-within-a-string/m-p/558990#M77221</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a string like below "&amp;nbsp;[CDO600705010] [S 88ABCV A B IT] [C23204348IT] "&lt;/P&gt;&lt;P&gt;Do you know how to get characters between open and close bracket&lt;/P&gt;&lt;P&gt;For instance:&lt;/P&gt;&lt;P&gt;CDO600705010&lt;/P&gt;&lt;P&gt;S 88ABCV A B IT&lt;/P&gt;&lt;P&gt;C23204348IT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sincerely&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:00:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-characters-between-brackets-within-a-string/m-p/558990#M77221</guid>
      <dc:creator>PhamBao</dc:creator>
      <dc:date>2023-06-09T16:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to get characters between brackets within a string??</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-characters-between-brackets-within-a-string/m-p/559000#M77222</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;s=" [CDO600705010] [S 88ABCV A B IT] [C23204348IT] ";
one = word(2,s,"[]");
show(one);
/*:

one = "CDO600705010";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Oct 2022 13:53:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-characters-between-brackets-within-a-string/m-p/559000#M77222</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-10-21T13:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get characters between brackets within a string??</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-characters-between-brackets-within-a-string/m-p/559021#M77227</link>
      <description>&lt;P&gt;Amazing! Appreciate It works like miracle&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 14:11:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-characters-between-brackets-within-a-string/m-p/559021#M77227</guid>
      <dc:creator>PhamBao</dc:creator>
      <dc:date>2022-10-21T14:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to get characters between brackets within a string??</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-characters-between-brackets-within-a-string/m-p/559161#M77245</link>
      <description>&lt;P&gt;I like&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;'s approach. I often use it. The character functions are handy!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is another approach using Regex() instead. It is not a solution. It is an illustration of how you might parse each string. I show two search patterns, but other patterns are possible. I wonder which way is faster, as it might be a consideration with many strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

string = {  "[CDO600705010]", "[S 88ABCV A B IT]", "[C23204348IT]" };
n = N Items( string );

For( s = 1, s &amp;lt;= n, s++,
	Show(
		Regex( string[s], "([\w\d\s]+)", "\1" );
	);
);

For( s = 1, s &amp;lt;= n, s++,
	Show(
		Regex( string[s], "[^\-[\]]+" );
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 16:15:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-characters-between-brackets-within-a-string/m-p/559161#M77245</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2022-10-21T16:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get characters between brackets within a string??</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-characters-between-brackets-within-a-string/m-p/559166#M77248</link>
      <description>&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/en/16.2/index.shtml#page/jmp/character-functions.shtml" target="_self"&gt;Word()&lt;/A&gt; is the function every JMP user should know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-MESSAGE title="If you learn only one Formula Editor function, Word() is the one" uid="30381" url="https://community.jmp.com/t5/JMP-Blog/If-you-learn-only-one-Formula-Editor-function-Word-is-the-one/m-p/30381#U30381" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-blog-thread lia-fa-icon lia-fa-blog lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 16:09:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-characters-between-brackets-within-a-string/m-p/559166#M77248</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2022-10-21T16:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to get characters between brackets within a string??</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-characters-between-brackets-within-a-string/m-p/559470#M77303</link>
      <description>&lt;P&gt;I would definitely go with Word() or Words() with this one, but there is a &lt;A href="https://www.jmp.com/support/help/en/16.2/#page/jmp/character-pattern-functions.shtml#" target="_blank" rel="noopener"&gt;Character Pattern&lt;/A&gt; thingie in JMP. It is fairly difficult to learn and it might have a bit limited use when compared to more simple methods (I haven't bothered to learn it). Script modified from a script found from&amp;nbsp; &lt;A href="https://community.jmp.com/t5/Discussions/Extract-text-from-string/m-p/450649/highlight/true#M69750" target="_self"&gt; Re: Extract text from string&lt;/A&gt; (post also has explanation of the matching)&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

// see https://community.jmp.com/t5/Discussions/Extract-text-from-string/td-p/450420
txt = " [CDO600705010] [S 88ABCV A B IT] [C23204348IT] ";

sp = Pat Span("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 ");

found_list = {};
Pat Match(
	txt,
	"[" + sp &amp;gt;&amp;gt; match + ("]") + Pat Test(
		Insert Into(found_list, match);
		0;
	)
);

show(found_list); 
// found_list = {"CDO600705010", "S 88ABCV A B IT", "C23204348IT"};&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But matching between multiple brackets could be one place where I could see myself using Character Patterns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See also &lt;A href="https://www.jmp.com/support/help/en/16.2/#page/jmp/pattern-matching.shtml#ww447620" target="_blank" rel="noopener"&gt; Scripting Guide &amp;gt; Types of Data &amp;gt; Pattern Matching&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Oct 2022 19:13:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-characters-between-brackets-within-a-string/m-p/559470#M77303</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-10-23T19:13:05Z</dc:date>
    </item>
  </channel>
</rss>

