<?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 to use Words function to extract only specific elements from string in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-use-Words-function-to-extract-only-specific-elements-from/m-p/840621#M101504</link>
    <description>&lt;P&gt;If you want two last elements, then you can use Word with negative indexing (or positive if you know the exact locations from the beginning of the string)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

str = "bal1_bla2_blbla3_blabla4";

res = Word([-2 -1], str, "_");

Show(res); // res = "blbla3_blabla4";&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Feb 2025 12:22:48 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2025-02-12T12:22:48Z</dc:date>
    <item>
      <title>How to use Words function to extract only specific elements from string</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-Words-function-to-extract-only-specific-elements-from/m-p/840609#M101502</link>
      <description>&lt;P&gt;Suppose I have a string of characters with common delimiter in a form of bal1_bla2_blbla3_blabla4&lt;/P&gt;&lt;P&gt;And I would like to create a new column that contains only "blbla3_blabla4", how can I apply words function for that?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 12:00:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-Words-function-to-extract-only-specific-elements-from/m-p/840609#M101502</guid>
      <dc:creator>VM04</dc:creator>
      <dc:date>2025-02-12T12:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Words function to extract only specific elements from string</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-Words-function-to-extract-only-specific-elements-from/m-p/840620#M101503</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;one solution in the UI would be to use Recode to achieve what you are aiming for.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Right click on your column header -&amp;gt; Recode -&amp;gt; right click on the red triangle under new value -&amp;gt; Advanced -&amp;gt; extract segment&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jonas_Rinne_0-1739362253495.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/72862i74F318E1112E2266/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jonas_Rinne_0-1739362253495.png" alt="Jonas_Rinne_0-1739362253495.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can find the JSL code&amp;nbsp;in the log and it is using the word function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/*:

// Recode column: Column 1 2
Local( {dt, col1},
	dt = Data Table( "Test table" );
	dt &amp;lt;&amp;lt; Begin Data Update;
	col1 = dt &amp;lt;&amp;lt; New Column( dt:Column 1 );
	col1 &amp;lt;&amp;lt; Set Name( "Column 1 2" );
	dt &amp;lt;&amp;lt; Move Selected Columns( {col1}, after( dt:Column 1 ) );
	For Each Row(
		dt,
		col1[] = Word(
			[3 4],
			dt:Column 1,
			Get Whitespace Characters() ||
			Get Punctuation Characters( Exclude Chars( "'-" ) ) || "_",
			Unmatched( dt:Column 1 )
		)
	);
	dt &amp;lt;&amp;lt; End Data Update;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;Jonas&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 12:16:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-Words-function-to-extract-only-specific-elements-from/m-p/840620#M101503</guid>
      <dc:creator>Jonas_Rinne</dc:creator>
      <dc:date>2025-02-12T12:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Words function to extract only specific elements from string</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-Words-function-to-extract-only-specific-elements-from/m-p/840621#M101504</link>
      <description>&lt;P&gt;If you want two last elements, then you can use Word with negative indexing (or positive if you know the exact locations from the beginning of the string)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

str = "bal1_bla2_blbla3_blabla4";

res = Word([-2 -1], str, "_");

Show(res); // res = "blbla3_blabla4";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Feb 2025 12:22:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-Words-function-to-extract-only-specific-elements-from/m-p/840621#M101504</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-02-12T12:22:48Z</dc:date>
    </item>
  </channel>
</rss>

