<?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: Searching every cell in one column to find a specific content in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/735734#M91676</link>
    <description>&lt;P&gt;Depending on your string format, you could maybe use Recode (note that Keep text if no match isn't checked)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1710788001887.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/62310iE8210E250F514381/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1710788001887.png" alt="jthi_0-1710788001887.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;or script using For Each Row. If you use For Each Row, you have many different options for parsing the string and how to store your results, below is another example&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(2),
	Compress File When Saved(1),
	New Column("Column 1",
		Character,
		"Nominal",
		Set Values(
			{"Class: 10 Table:15 Stat:NA loc:NA teacher:Sam",
			"Class: 11 Table:11 Stat:NA loc:NA teacher:Sam"}
		)
	)
);

result = {};

For Each Row(dt,
	res = Regex(:Column 1, "^(Class: \d+) (.*)?", "\2");
	If(!IsMissing(res),
		Insert Into(result, res);
	);
);

show(result); 
// result = {"Table:15 Stat:NA loc:NA teacher:Sam", "Table:11 Stat:NA loc:NA teacher:Sam"};&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 18 Mar 2024 18:57:49 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-03-18T18:57:49Z</dc:date>
    <item>
      <title>Searching every cell in one column to find a specific content</title>
      <link>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/735476#M91670</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a jmp data table with a column that contains different strings at each row. I would like to know if I can loop that column to find a specific part of the string in that cell.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This an example of the strings:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Class: 10 Table:15 Stat:NA loc:NA teacher:Sam --&amp;gt; content of the cell&lt;/P&gt;&lt;P&gt;Class: 11 Table:11 Stat:NA loc:NA teacher:Sam&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The challenge is that I have different class # and different table #. However, I only need to find the cells the starts with "Class:&amp;nbsp;#" and grab the rest of the cells into a list.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my question is: can I do a partial cell search at that specifc column?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2024 17:49:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/735476#M91670</guid>
      <dc:creator>RA899</dc:creator>
      <dc:date>2024-03-18T17:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Searching every cell in one column to find a specific content</title>
      <link>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/735502#M91671</link>
      <description>&lt;P&gt;This is one possible way to handle this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = Current Data Table();

foundList = {};

For Each Row(
	If(
		Word( 1, thestringcolumn, " " ) &amp;amp; Is Missing(
			Num( word * 2, thestringcolumn, " " )
		) == 0,
		Insert Into(
			foundList,
			Substr(
				thestringcolumn,
				Length( Word( 1, thestringcolumn, " " ) )
				+Length( Word( 2, thestringcolumn, " " ) ) + 2
			)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Mar 2024 18:14:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/735502#M91671</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-03-18T18:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Searching every cell in one column to find a specific content</title>
      <link>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/735734#M91676</link>
      <description>&lt;P&gt;Depending on your string format, you could maybe use Recode (note that Keep text if no match isn't checked)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1710788001887.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/62310iE8210E250F514381/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1710788001887.png" alt="jthi_0-1710788001887.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;or script using For Each Row. If you use For Each Row, you have many different options for parsing the string and how to store your results, below is another example&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(2),
	Compress File When Saved(1),
	New Column("Column 1",
		Character,
		"Nominal",
		Set Values(
			{"Class: 10 Table:15 Stat:NA loc:NA teacher:Sam",
			"Class: 11 Table:11 Stat:NA loc:NA teacher:Sam"}
		)
	)
);

result = {};

For Each Row(dt,
	res = Regex(:Column 1, "^(Class: \d+) (.*)?", "\2");
	If(!IsMissing(res),
		Insert Into(result, res);
	);
);

show(result); 
// result = {"Table:15 Stat:NA loc:NA teacher:Sam", "Table:11 Stat:NA loc:NA teacher:Sam"};&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Mar 2024 18:57:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/735734#M91676</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-03-18T18:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: Searching every cell in one column to find a specific content</title>
      <link>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/738120#M91940</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;.&amp;nbsp;This works perfectly for the example I provided above.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do have a follow up question, let's say we have the following String list,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;10::Class: A&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;11::Class: A1&amp;nbsp;&lt;/P&gt;&lt;P&gt;12::Class: A2&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;20::Class B&lt;/P&gt;&lt;P&gt;21::Class B1&lt;/P&gt;&lt;P&gt;22::Class B1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;30::Class C&lt;/P&gt;&lt;P&gt;31::Class C1&lt;/P&gt;&lt;P&gt;32::Class C2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say I want to make a list for each class. I want the first to be ClassAList = (11::Class: A&amp;nbsp; ,11::Class: A&amp;nbsp; ,11::Class: A );&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried modifying regex() to look for the leading digit in a string and then move it into the corresponding list. I used something like this:&amp;nbsp; Regex("10:::Class" , "[1]")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue here is that it is looking for [1] across all the string. Is it possible to select the index where the regex should look for a match?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other issue here is that returns 1 only, not the whole string.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any guidance is appreciated.&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>Fri, 22 Mar 2024 22:01:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/738120#M91940</guid>
      <dc:creator>RA899</dc:creator>
      <dc:date>2024-03-22T22:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Searching every cell in one column to find a specific content</title>
      <link>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/738215#M91949</link>
      <description>&lt;P&gt;This might give some idea what you could do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

mylist = {"10::Class: A", "11::Class: A1", "12::Class: A2", "20::Class B", "21::Class B1",
"22::Class B1", "30::Class C", "31::Class C1", "32::Class C2"};

class_pattern = "\d+::(Class:? [A-Z])";

aa = Associative Array();
For Each({myitem}, mylist,
	res = Regex(myitem, class_pattern, "\1");
	If(!Contains(aa, res),
		aa[res] = {};
	);
	Insert Into(aa[res], myitem);
);

show(aa);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://regex101.com/r/itqqww/1" target="_blank"&gt;https://regex101.com/r/itqqww/1&lt;/A&gt; for explanation of the regex pattern&lt;/P&gt;</description>
      <pubDate>Sat, 23 Mar 2024 13:38:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/738215#M91949</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-03-23T13:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Searching every cell in one column to find a specific content</title>
      <link>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/739394#M92120</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;.&amp;nbsp;This works perfectly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Follow up question:&lt;/P&gt;&lt;P&gt;I would like to group the list into subgroups based on only and only the first digit. I tried to use regex Anchors to do so. However, instead of matching only the first digit, it matches the first and whatever digits comes after.&amp;nbsp; Any guidance is appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 21:04:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/739394#M92120</guid>
      <dc:creator>RA899</dc:creator>
      <dc:date>2024-03-27T21:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Searching every cell in one column to find a specific content</title>
      <link>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/739415#M92124</link>
      <description>&lt;P&gt;Do you mean the Class B1 part? You can modify the regex by adding \d? inside brackets (&lt;A href="https://regex101.com/r/Yfh6pZ/1" target="_blank"&gt;https://regex101.com/r/Yfh6pZ/1&lt;/A&gt;). \d will match a digit and ? will match the token before it ZERO or ONE times. If you don't want to capture groups which have no digits, leave out ? or replace it with {1}&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1711602075375.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/62753iC5BE6C1D8998C2CB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1711602075375.png" alt="jthi_0-1711602075375.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;[
	"Class B" =&amp;gt; {"20::Class B"}, 
	"Class B1" =&amp;gt; {"21::Class B1", "22::Class B1"}, 
	"Class C" =&amp;gt; {"30::Class C"}, 
	"Class C1" =&amp;gt; {"31::Class C1"}, 
	"Class C2" =&amp;gt; {"32::Class C2"}, 
	"Class: A" =&amp;gt; {"10::Class: A"}, 
	"Class: A1" =&amp;gt; {"11::Class: A1"}, 
	"Class: A2" =&amp;gt; {"12::Class: A2"}
]&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Mar 2024 05:05:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Searching-every-cell-in-one-column-to-find-a-specific-content/m-p/739415#M92124</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-03-28T05:05:29Z</dc:date>
    </item>
  </channel>
</rss>

