<?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 make Regex case insensitive in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-make-Regex-case-insensitive/m-p/778590#M96014</link>
    <description>&lt;P&gt;If you wish to extract file extension I would suggest checking out Word(), Words(), Item() and Items() functions instead of using Regex.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Aug 2024 21:13:37 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-08-02T21:13:37Z</dc:date>
    <item>
      <title>How to make Regex case insensitive</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-make-Regex-case-insensitive/m-p/778565#M96011</link>
      <description>&lt;P&gt;Hi. &amp;nbsp;Does anyone know the best way to make a regex search case insensitive in JSL? &amp;nbsp;For example, I wish to extract the file extension from a path name, and I don't want it to matter if the extension is ".csv" or ".CSV" or ".cSv". &amp;nbsp;If I try the following, it will only work on filenames whose extensions are lowercase:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;filename = Regex(path, "(.+\/)*([^\/]+)\.(csv|xlsx)$", "\2")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One method is to just convert the entire path to lowercase before doing regex on it, but for various reasons I don't want to do that. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;filename = Regex(LowerCase(path), "(.+\/)*([^\/]+)\.(csv|xlsx)$", "\2")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other method I tried is to use the "(?i)" modifier in the match string, but I get an error:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;filename = Regex(path, "(?i)(.+\/)*([^\/]+)\.(csv|xlsx)$", "\2")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;"regex found a quantifier *, +,&amp;nbsp;?, or {&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;in an invalid position, the result is undefined in access or evaluation of 'Regex'". &amp;nbsp;I'm guessing that modifier is not supported in JSL. &amp;nbsp;Any ideas?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 20:23:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-make-Regex-case-insensitive/m-p/778565#M96011</guid>
      <dc:creator>nikles</dc:creator>
      <dc:date>2024-08-02T20:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to make Regex case insensitive</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-make-Regex-case-insensitive/m-p/778590#M96014</link>
      <description>&lt;P&gt;If you wish to extract file extension I would suggest checking out Word(), Words(), Item() and Items() functions instead of using Regex.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 21:13:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-make-Regex-case-insensitive/m-p/778590#M96014</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-02T21:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to make Regex case insensitive</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-make-Regex-case-insensitive/m-p/778768#M96017</link>
      <description>&lt;P&gt;There is also IGNORECASE flag in Regex in JMP, but still I would suggest using other methods than regex if you just want the filename (or extension or both)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

path = Convert File Path("$SAMPLE_DATA/Big Class.jmp");
filename1 = Regex(path, "(.+\/)*([^\/]+)\.(JMP)$", "\2", IGNORECASE);
filename2 = Word(-2, path, "\/.");
filename3 = Word(-1, path, "\/");

Show(filename1, filename2, filename3);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1722668744463.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66800iFF6D7C2200A6AFDF/image-size/large?v=v2&amp;amp;px=999" role="button" title="jthi_0-1722668744463.png" alt="jthi_0-1722668744463.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/en/18.0/#page/jmp/character-functions-2.shtml?os=win&amp;amp;source=application#ww4813286" target="_blank" rel="noopener"&gt;Regex(source, pattern, (&amp;lt;replacement string&amp;gt;, &amp;lt;format, "GLOBALREPLACE", "IGNORECASE"&amp;gt;&amp;gt;)&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/en/18.0/#page/jmp/regex-function.shtml#ww436102" target="_blank" rel="noopener"&gt; Scripting Guide &amp;gt; Types of Data &amp;gt; Regular Expressions &amp;gt; Regex Function&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Aug 2024 07:06:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-make-Regex-case-insensitive/m-p/778768#M96017</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-03T07:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to make Regex case insensitive</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-make-Regex-case-insensitive/m-p/778805#M96020</link>
      <description>&lt;P&gt;This hybrid code works&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
path = "C:\users\big.cSv";
filename = "";
ext = Word( -1, path, "." );
If( Uppercase( ext ) == "CSV" | Uppercase( ext ) == "XLSX",
	filename = Eval(
		Parse(
			"Regex(path, \!"(.+\/)*([^\/]+)\." || ext || "$\!", \!"\2\!")"
		)
	)
);
Show( filename );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My preferred JSL is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
path = "C:\users\big.cSv";
filename = "";
ext = Word( -1, path, "." );
If( Uppercase( ext ) == "CSV" | Uppercase( ext ) == "XLSX",
	filename = Word( -2, path, ".\/" )
);
Show( filename );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 03 Aug 2024 13:55:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-make-Regex-case-insensitive/m-p/778805#M96020</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-08-03T13:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to make Regex case insensitive</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-make-Regex-case-insensitive/m-p/779433#M96059</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;. &amp;nbsp;I knew I'd seen this somewhere. &amp;nbsp;Of course it was in the scripting guide. &amp;nbsp;Ha.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 21:01:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-make-Regex-case-insensitive/m-p/779433#M96059</guid>
      <dc:creator>nikles</dc:creator>
      <dc:date>2024-08-05T21:01:49Z</dc:date>
    </item>
  </channel>
</rss>

