<?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: Quickly show Data View with subset of rows that match regex in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890924#M105241</link>
    <description>&lt;P&gt;You can also force the focus to be in the window by using Modal Window but those can be quite bad for user experience.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jul 2025 07:44:54 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2025-07-30T07:44:54Z</dc:date>
    <item>
      <title>Quickly show Data View with subset of rows that match regex</title>
      <link>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890175#M105199</link>
      <description>&lt;P data-start="172" data-end="239"&gt;I'm looking for a JSL script that does the following:&lt;/P&gt;
&lt;P data-start="172" data-end="239"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL data-start="241" data-end="582"&gt;
&lt;LI data-start="241" data-end="311"&gt;
&lt;P data-start="244" data-end="311"&gt;Gets the &lt;STRONG data-start="253" data-end="283"&gt;currently selected columns&lt;/STRONG&gt; in the active data table.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="312" data-end="353"&gt;
&lt;P data-start="315" data-end="353"&gt;Takes the &lt;STRONG data-start="325" data-end="350"&gt;first selected column&lt;/STRONG&gt;.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="354" data-end="410"&gt;
&lt;P data-start="357" data-end="410"&gt;Prompts the &lt;STRONG data-start="369" data-end="407"&gt;user to enter a regular expression&lt;/STRONG&gt;.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="411" data-end="516"&gt;
&lt;P data-start="414" data-end="516"&gt;Selects only the rows in the table where the &lt;STRONG data-start="471" data-end="513"&gt;value in that column matches the regex&lt;/STRONG&gt;.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="517" data-end="582"&gt;
&lt;P data-start="520" data-end="582"&gt;Opens a &lt;STRONG data-start="528" data-end="548"&gt;Data View window&lt;/STRONG&gt; showing only those matching rows.&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P data-start="619" data-end="725"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="619" data-end="725"&gt;Is this possible with JSL?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jul 2025 23:29:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890175#M105199</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2025-07-28T23:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: Quickly show Data View with subset of rows that match regex</title>
      <link>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890197#M105201</link>
      <description>&lt;P&gt;It is possible. What have you tried?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is very basic example missing all checks which could (and most likely should) be implemented&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = Current Data Table();

col = (dt &amp;lt;&amp;lt; Get Selected Columns("String"))[1]; // I suggest dropping non-character columns

run_expr = Expr(
	rgx_pattern = teb &amp;lt;&amp;lt; Get Text; // You could check if the pattern is valid regex
	dt &amp;lt;&amp;lt; Select Where(!Is Missing(Regex(Column(dt, col)[Row()], rgx_pattern)));
	// add check if any rows have been selected
	dt &amp;lt;&amp;lt; Data View; // If linked subset is fine, that is most likely better as it can avoid using select where
	dt &amp;lt;&amp;lt; Clear Select;
	wait(0);
);

nw = New Window("",
	H List Box(
		Lineup Box(N Col(2),
			Text Box("Enter regex pattern"),
			teb = Text Edit Box("")
		),
		Lineup Box(N Col(1),
			Button Box("OK",
				run_expr
			),
			Button Box("Cancel")
		)
	)
);

Write();&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Jul 2025 04:14:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890197#M105201</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-07-29T04:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Quickly show Data View with subset of rows that match regex</title>
      <link>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890672#M105230</link>
      <description>&lt;P&gt;That works, thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To be honest, I didn't include any code because my attempt wasn't very close, and exposes some fundamental misunderstandings about JSL that probably come from me learning GUI scripting from AppleScript and Matlab.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would've gotten the list of selected column names, picked the first one, but then I expected some kind of "display dialog" function which returns a string, but that apparently doesn't exist, and forces you into this new-window/list-box/button-expression syntax, which was fairly unintuitive to me, but makes more sense now that I see what it's doing.&amp;nbsp; I tried ChatGPT, but it created long scripts that didn't run at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A few questions about your solution, if you have time:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Why doesn't the "Cancel" button do anything?&amp;nbsp; I presume because you have no 2nd argument to its Button Box() call, but what expression would close the current window?&amp;nbsp; Close()?&amp;nbsp; I tried "Button Box&lt;SPAN class="s1"&gt;(&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;"Cancel"&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;Close&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;())" but it errors out with an error I don't understand.&amp;nbsp; I mimicked your approach and tried "Close Window" which seems to work, but I expect there's a cleaner way to do it.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;Your "Get Selected Columns()" call has "String" as an argument, but the documentation shows that function takes no arguments.&amp;nbsp; What does "String" mean here, and how did you know it would be accepted or what it does?&lt;/LI&gt;
&lt;LI&gt;I'd like to start typing immediately after running the script, but the focus isn't in the right place.&amp;nbsp; I tried "teb &amp;lt;&amp;lt; SetFocus;" after the "nw=..." expression, but JMP says text edit boxes don't understand that message.&lt;/LI&gt;
&lt;LI&gt;Is it possible to make Regex be case insensitive, and if so, how?&amp;nbsp; (I tried adding "&amp;lt;IGNORECASE&amp;gt;" to the Regex arguments per the documentation, but it errors out.)&lt;/LI&gt;
&lt;LI&gt;Is it possible to make return/enter trigger the "Ok" script with the teb box focused?&lt;/LI&gt;
&lt;LI&gt;If the user has no selected columns, I'd like to use the first character column, but after about 20 different attempts I gave up trying to figure out which column that is.&lt;/LI&gt;
&lt;LI&gt;I would prefer the data view subset be linked, does that change the approach?&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's what I have so far:&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); 

run_expr = Expr(
	dt = Current Data Table();
	selCols = dt &amp;lt;&amp;lt; Get Selected Columns("String");
	if(N Items(selCols)==0, selCols = dt &amp;lt;&amp;lt; get column names("String") );
	col = selCols[1];
	rgx_pattern = teb &amp;lt;&amp;lt; Get Text;
	dt &amp;lt;&amp;lt; Select Where(!Is Missing(Regex(Column(dt, col)[Row()], rgx_pattern)));
	dt &amp;lt;&amp;lt; Data View; // I prefer a linked subset, what changes here?
	dt &amp;lt;&amp;lt; Clear Select;
	wait(0);
	nw &amp;lt;&amp;lt; Close Window;
);

close_expr = Expr(nw &amp;lt;&amp;lt; Close Window);

nw = New Window("",
	H List Box(
		Lineup Box(N Col(2),
			Text Box("Enter regex pattern"),
			teb = Text Edit Box("", &amp;lt;&amp;lt;Set Width(400))
		),
		Lineup Box(N Col(1),
			Button Box("OK",
				run_expr
			),
			Button Box("Cancel", close_expr)
		)
	)
);

teb &amp;lt;&amp;lt; Set Focus();

Write();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'd love to open Big Class, run the script, then type "ob.+t&amp;lt;enter&amp;gt;" and have it bring up a Data View of just the two Roberts.&amp;nbsp; Right now it's close -- after running the script, I have to press tab, then OB.+T, then enter twice.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 17:31:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890672#M105230</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2025-07-29T17:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Quickly show Data View with subset of rows that match regex</title>
      <link>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890737#M105231</link>
      <description>&lt;OL&gt;
&lt;LI&gt;I created as minimal example as I could, so Cancel doesn't contain expression to close the window&lt;/LI&gt;
&lt;LI&gt;I just tried if "String" would work like it does with &amp;lt;&amp;lt; get column names() and it does. Test it out without the "String" value and see what you get (references instead of strings). In my opinion, working with the column references is a nightmare so I always use strings of column names and convert them as needed. But it really is up to you if you prefer using references (or whatever that colon syntax is)&lt;/LI&gt;
&lt;LI&gt;I think you are stuck with tab unless you wish to use complicated workarounds&lt;LI-MESSAGE title="Allow SetFocus to be used with interactive display elements (TextEditBox, Button...)" uid="364720" url="https://community.jmp.com/t5/JMP-Wish-List/Allow-SetFocus-to-be-used-with-interactive-display-elements/m-p/364720#U364720" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;You could Lowercase() user input and wrap the column reference with Lowercase(). Or, I think you could add the default capturing group to Regex() when using INGORECASE:&amp;nbsp;&lt;EM&gt;Regex("ABCD", "d", "\0", IGNORECASE)&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;You could try of &amp;lt;&amp;lt; Set Function would fit your needs. It will execute the script on commit and enter should trigger that (as does clicking outside of the text edit box).&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&amp;lt;&amp;lt; Get Column Names(Character, String)[1]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;r = dt &amp;lt;&amp;lt; Get Rows Where(!Is Missing(Regex(Column(dt, col)[Row()], rgx_pattern)));
dt_subset = dt &amp;lt;&amp;lt; Subset(Rows(dt), Selected Columns(0), Link to original data table(1));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;There are plenty of improvements which could be done but what those could be depends on the real use case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: Added link to original data table(1) to subset&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 10:11:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890737#M105231</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-07-30T10:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Quickly show Data View with subset of rows that match regex</title>
      <link>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890887#M105235</link>
      <description>&lt;P&gt;Excellent, thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just one more question:&amp;nbsp; If multiple columns are selected, I'd like to perform the regex on the column values concatenated together as strings, and if no columns are selected, I'd like to do the same thing on *all* columns.&amp;nbsp; This effectively mimics the behavior of egrep on the table.&amp;nbsp; Is that reasonably doable?&amp;nbsp; See commented line below for my initial attempt at this, but it doesn't pull just the values from the selected columns, so it's not there yet (and it doesn't work).&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 ); 

run_expr = Expr(
	dt = Current Data Table();
	selCols = dt &amp;lt;&amp;lt; Get Selected Columns( "String" );
	If( N Items( selCols ) == 0,
		selCols = dt &amp;lt;&amp;lt; Get Column Names( "String" )
	);
	col = selCols[1];
	rgx_pattern = teb &amp;lt;&amp;lt; Get Text;
	dt &amp;lt;&amp;lt; Select Where( !Is Missing( Regex( Column( dt, col )[Row()], rgx_pattern, "1", IGNORECASE ) ) );
//	dt &amp;lt;&amp;lt; Select Where( !Is Missing( Regex( Concat Items( dt &amp;lt;&amp;lt; get Rows(Row())," "), rgx_pattern, "1", IGNORECASE ) ) );
	dt &amp;lt;&amp;lt; Data View;
	Wait( 0 );
);

close_expr = Expr( nw &amp;lt;&amp;lt; Close Window; Wait( 0 ); );

nw = New Window( "Table Egrep",
	H List Box(
		lb1 = Lineup Box( N Col( 2 ),
			Text Box( "Select column to Enter regex pattern" ),
			teb = Text Edit Box( "", Set Script( run_expr ), &amp;lt;&amp;lt;Set Width( 400 ) )
		),
		Lineup Box( N Col( 1 ), Button Box( "OK", close_expr ), Button Box( "Cancel", close_expr ) )
	)
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;FYI, the "Set Script" above handles the immediate execute on "enter", which works great.&amp;nbsp; The only missing desired behavior is the one above, and the need to hit "tab" to get the focus into the text edit box.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 23:23:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890887#M105235</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2025-07-29T23:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: Quickly show Data View with subset of rows that match regex</title>
      <link>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890896#M105238</link>
      <description>&lt;P&gt;It might start getting slow at some point and you should add a check that only character columns are selected, but you can build expression to create the concat&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);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt &amp;lt;&amp;lt; Select Columns({:name, :sex});
rgx_patter = "EF";

cols = dt &amp;lt;&amp;lt; Get Selected Columns("String");

conc_expr = Expr(Concat());

For Each({colname}, cols,
	Insert Into(conc_expr, Name Expr(As Column(dt, colname)));
);

regex_expr = Substitute(
	Expr(!Is Missing(Regex(_conc_expr_, _rgx_pattern_, "\0", IGNORECASE))),
	Expr(_conc_expr_), Name Expr(conc_expr),
	Expr(_rgx_pattern_), rgx_pattern
);

rows_of_interest = dt &amp;lt;&amp;lt; Get Rows Where(regex_expr);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 04:20:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890896#M105238</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-07-30T04:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Quickly show Data View with subset of rows that match regex</title>
      <link>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890924#M105241</link>
      <description>&lt;P&gt;You can also force the focus to be in the window by using Modal Window but those can be quite bad for user experience.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 07:44:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/890924#M105241</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-07-30T07:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Quickly show Data View with subset of rows that match regex</title>
      <link>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/891076#M105253</link>
      <description>&lt;P&gt;Just when I thought I was starting to understand…&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The documentation says that Expr() "returns its argument unevaluated"—which honestly means nothing to me. It sounds like it just gives back whatever you pass in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your earlier code, it looked like a subroutine, which made sense at the time. But now I’m seeing Expr(Concat()), and I can’t figure out what’s actually being concatenated. Then later, you Insert Into() that Expr() object—but how does JMP know where to insert the values? Even ChatGPT isn’t helping me make sense of this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It feels like trying to recreate a magician’s trick just by copying the hand movements—frustrating, especially since the documentation for Get Row() seems to promise exactly the behavior I’m trying to get.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;None of this is your fault, of course, and I really appreciate your help. I think what I have now will work well enough. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 14:12:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/891076#M105253</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2025-07-30T14:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: Quickly show Data View with subset of rows that match regex</title>
      <link>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/891089#M105257</link>
      <description>&lt;P&gt;Nothing is being concatenated here&amp;nbsp;Expr(Concat()). In this case you can see this as a collector for arguments which will be concatenated after you have finished building the expression. You could also build it with a list and then substitute the list with concat&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

val1 = "name";
val2 = "sex";

c = {};

Insert Into(c, Name Expr(As Column(dt, val1)));
Insert Into(c, Name Expr(As Column(dt, val2)));

show(c);

Substitute Into(c, Expr(List()), Expr(Concat()));

Show(c);

// Example use
Eval(EvalExpr(
	dt &amp;lt;&amp;lt; New Column("Concat", Character, Nominal, Formula(
		Expr(Name Expr(c))
	));	
));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Jul 2025 15:09:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/891089#M105257</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-07-30T15:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Quickly show Data View with subset of rows that match regex</title>
      <link>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/899330#M105925</link>
      <description>&lt;P&gt;Ok, I think I've figured this out -- this script is basically the tabular equivalent of the unix/linux/mac "egrep" command, i.e. select/show just the rows that match a user-entered regular expression (search string):&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 ); 

If(
	ex = New Window( "Enter search regex",
		&amp;lt;&amp;lt;modal,
		&amp;lt;&amp;lt;return result,
		V List Box(
			H List Box( userinput = Text Edit Box( "", &amp;lt;&amp;lt;Set script( okBtn &amp;lt;&amp;lt; Click() ), &amp;lt;&amp;lt;set width( 400 ) ) ),
			H List Box( okBtn = Button Box( "OK" ), Button Box( "Cancel" ) )
		)
	);
	ex["button"] != 1;	// did the user not press button #1?
,
	Stop()	// then get out
);
inputRegex = ex["userInput"];

dt = Current Data Table();
selCols = dt &amp;lt;&amp;lt; Get Selected Columns( "String" );
If( N Items( selCols ) == 0,
	selCols = dt &amp;lt;&amp;lt; Get Column Names( "String" )
);
col = selCols[1];
dt &amp;lt;&amp;lt; Select Where( !Is Missing( Regex( Column( dt, col )[Row()], inputRegex, "1", IGNORECASE ) ) );
dt2 = dt &amp;lt;&amp;lt; Data View;
Column(dt2,col) &amp;lt;&amp;lt; Set Display Width( 0 );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;All of the buttons work correctly, and it's reasonably fast even with many thousands of rows.&amp;nbsp; Personally, I made an Addin of it and tied it to cmd-shift-e (egrep) and now use it all the time.&amp;nbsp; Of course I'm open to suggestions on how to improve it.&amp;nbsp; Hope this helps someone!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(And big thanks to&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;for his patience and insight!)&lt;/P&gt;</description>
      <pubDate>Tue, 09 Sep 2025 14:17:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/899330#M105925</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2025-09-09T14:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Quickly show Data View with subset of rows that match regex</title>
      <link>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/899347#M105930</link>
      <description>&lt;P&gt;Looks good! I would make few small changes:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Before opening the New Window check that there is a table open and if there isn't one, run stop();&lt;/LI&gt;
&lt;LI&gt;If there are no matches, the last row will throw an error. You could either check selected row count and use stop() if it is 0 or show information to the user that there was no matches&lt;/LI&gt;
&lt;LI&gt;&amp;lt;&amp;lt; Get Rows Where is mos likely faster than &amp;lt;&amp;lt; Select Where
&lt;UL&gt;
&lt;LI&gt;Some additional speed-up can most likely be gained by evaluating the column reference&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;&amp;lt;&amp;lt; On Validate could also be used if you wish to let user input new regex if the first doesn't have any matches&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

If(N Table() == 0,
	stop(); // display error message to user if necessary
);

dt = Current Data Table();

nw = New Window("Enter search regex",
	&amp;lt;&amp;lt;modal,
	&amp;lt;&amp;lt;return result,
	V List Box(align("center"),
		Panel Box("Input search regex", 
			userinput = Text Edit Box("", 
				&amp;lt;&amp;lt;Set Script(
					okBtn &amp;lt;&amp;lt; Click()
				)
				, &amp;lt;&amp;lt;set width(400)
				, &amp;lt;&amp;lt; Set Hint("search regex...")
			)
		),
		Lineup Box(N Col(2),
			okBtn = Button Box("OK"),
			Button Box("Cancel")
		)
	)
);

If(nw["Button"] != 1,
	stop();
);

inputRegex = nw["userInput"];
If(IsMissing(inputRegex),
	stop(); // empty regex
);

selCols = dt &amp;lt;&amp;lt; Get Selected Columns("String");
If(N Items(selCols) &amp;gt; 0,
	col = selCols[1];
,
	col = Column(dt, 1) &amp;lt;&amp;lt; get name;
);

selrows = Eval(EvalExpr(
	dt &amp;lt;&amp;lt; Get Rows Where(!Is Missing(Regex(Expr(NameExpr(As Column(dt, col))), inputRegex, "1", IGNORECASE)));
));

If(N Rows(selrows) == 0,
	stop(); // display error message if necessary, this could also be done already within modal window (&amp;lt;&amp;lt; On Validate), if you wish to let user perform new search
);

dt2 = dt &amp;lt;&amp;lt; Subset(Rows(selrows), Selected Columns(0), Link to original data table(1), Output Table(""));
// dt2 &amp;lt;&amp;lt; Select Rows(1::NRows(dt2)); // to select rows if necessary&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Tue, 09 Sep 2025 15:10:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickly-show-Data-View-with-subset-of-rows-that-match-regex/m-p/899347#M105930</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-09-09T15:10:50Z</dc:date>
    </item>
  </channel>
</rss>

