<?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: search substring  from vareity of string in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/784609#M96879</link>
    <description>&lt;P&gt;Really appreciate your timely assistance. with the formula, error codes are picked up but some other characters show up as well. I solved it using left(). but I like to know why the other characters show up over there？&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ReliabilityWolf_0-1724724126047.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/67562iB18D149B7FA64C8A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ReliabilityWolf_0-1724724126047.png" alt="ReliabilityWolf_0-1724724126047.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Aug 2024 02:02:57 GMT</pubDate>
    <dc:creator>ReliabilityWolf</dc:creator>
    <dc:date>2024-08-27T02:02:57Z</dc:date>
    <item>
      <title>search substring  from vareity of string</title>
      <link>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/784047#M96869</link>
      <description>&lt;P&gt;I have a column with name of failure, which contains all variety of strings. I like to search error code with start of "ex". the error code is 10-character string with start of "ex". and put the 1st error code into column of "1st code", all error codes into column of "all codes. what formula is set to both columns? sorry to bother again. I need to quickly make my work in hands closed firstly, then take time to learn JMP help document.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ReliabilityWolf_0-1724685518572.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/67552iE41F6B0930BE957F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ReliabilityWolf_0-1724685518572.png" alt="ReliabilityWolf_0-1724685518572.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 15:29:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/784047#M96869</guid>
      <dc:creator>ReliabilityWolf</dc:creator>
      <dc:date>2024-08-26T15:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: search substring  from vareity of string</title>
      <link>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/784069#M96870</link>
      <description>&lt;P&gt;This post might help &lt;LI-MESSAGE title="Extract failure part code from unstructured string" uid="699685" url="https://community.jmp.com/t5/Discussions/Extract-failure-part-code-from-unstructured-string/m-p/699685#U699685" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 15:44:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/784069#M96870</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-26T15:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: search substring  from vareity of string</title>
      <link>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/784117#M96872</link>
      <description>&lt;P&gt;Here is one way to create these 2 columns&lt;/P&gt;
&lt;P&gt;Formula for :fst code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;start = contains(:Failure,"0x");
if(start&amp;gt;0,substr(:Failure,start,start+10),"");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Formula for :All Codes&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;theCodes = {};;
theString = :Failure;
While( Contains( theString, "0x" ) &amp;gt; 0,
	start = Contains( theString, "0x" );
	Insert Into( theCodes, Substr( theString, start, start + 10 ) );
	theString = Substr( theString, start + 10 );
);
concat items(theCodes, ",");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Aug 2024 17:02:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/784117#M96872</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-08-26T17:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: search substring  from vareity of string</title>
      <link>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/784609#M96879</link>
      <description>&lt;P&gt;Really appreciate your timely assistance. with the formula, error codes are picked up but some other characters show up as well. I solved it using left(). but I like to know why the other characters show up over there？&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ReliabilityWolf_0-1724724126047.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/67562iB18D149B7FA64C8A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ReliabilityWolf_0-1724724126047.png" alt="ReliabilityWolf_0-1724724126047.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 02:02:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/784609#M96879</guid>
      <dc:creator>ReliabilityWolf</dc:creator>
      <dc:date>2024-08-27T02:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: search substring  from vareity of string</title>
      <link>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/784628#M96880</link>
      <description>&lt;P&gt;Without having your data table to use to debug the issue, I am not sure what the issue is.&amp;nbsp; Try this modification and see if it works better.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;start = contains(:Failure,"0x");
x="";
if(start&amp;gt;0,x=substr(:Failure,start,start+10),"");
x;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Aug 2024 02:36:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/784628#M96880</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-08-27T02:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: search substring  from vareity of string</title>
      <link>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/785052#M96885</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;thanks for your time on the topic. I tried it again, it still fails. here is the data table for your debug.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 07:21:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/785052#M96885</guid>
      <dc:creator>ReliabilityWolf</dc:creator>
      <dc:date>2024-08-27T07:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: search substring  from vareity of string</title>
      <link>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/785430#M96890</link>
      <description>&lt;P&gt;My error,&lt;/P&gt;
&lt;P&gt;The length of the Substr element should be Start, not Start+10.&lt;/P&gt;
&lt;P&gt;First Code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;start = Contains( :Failure, "0x" );
If( start &amp;gt; 0,
	Substr( :Failure, start, 10 ),
	""
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;All Codes&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;theCodes = {};
theString = :Failure;
While( Contains( theString, "0x" ) &amp;gt; 0,
	start = Contains( theString, "0x" );
	Insert Into( theCodes, Substr( theString, start, 10 ) );
	theString = Substr( theString, start + 10 );
);
Concat Items( theCodes, "," );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Aug 2024 10:08:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/785430#M96890</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-08-27T10:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: search substring  from vareity of string</title>
      <link>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/786013#M96911</link>
      <description>&lt;P&gt;thanks a million!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 16:05:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/786013#M96911</guid>
      <dc:creator>ReliabilityWolf</dc:creator>
      <dc:date>2024-08-27T16:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: search substring  from vareity of string</title>
      <link>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/786069#M96912</link>
      <description>&lt;P&gt;If it is possible that you have messages mixed in which start with 0x but aren't error codes simple Contains might work, but based on the examples you have provided us with, this doesn't seem to be the case (or if you have for example 0x123456 which is shorter than what you defined as errorcode).&lt;/P&gt;
&lt;P&gt;If this ends up being the case, I would look at the Regex (you can use similar idea with While loop as Jim did show with contains). But you have to have good knowledge of the allowed characters to build robust pattern for proper matching.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 16:21:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/786069#M96912</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-27T16:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: search substring  from vareity of string</title>
      <link>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/787297#M96928</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;thanks for your comments. I am trying to use Regex to search the substring starting with 0x. based on your recommended post, it's a good idea for&lt;SPAN&gt;&amp;nbsp;"&lt;/SPAN&gt;&lt;SPAN&gt;New Column by Text Matching&lt;/SPAN&gt;&lt;SPAN&gt;". I am thinking how to build the pattern for the error code ( or the error code is not limited to 10 characters). the instruction of&amp;nbsp;&lt;/SPAN&gt;Backreferences and Capturing Groups for Regex can help me to understand the related JSL, but it's a little hard for me to write JSL. i think more JSL examples I read, sooner I learn to write JSL. back to the subject,&amp;nbsp; could you do me a favor to show the Regex pattern of the error code?&amp;nbsp; for example in your post, it is&lt;/P&gt;&lt;PRE class="language-jsl"&gt;&lt;CODE&gt;failure_pattern = "[A-Z]+\d+[A-Z]?"&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 03:22:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/787297#M96928</guid>
      <dc:creator>ReliabilityWolf</dc:creator>
      <dc:date>2024-08-28T03:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: search substring  from vareity of string</title>
      <link>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/787352#M96929</link>
      <description>&lt;P&gt;Given the sample data table you provided, the formula to pull out the 1st error code using the Regex() function is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Regex( :Failure, "[A-Z]+\d+[A-Z]?" )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The Definition and Examples of the Regex() function is found in the Scripting Index&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 04:30:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/787352#M96929</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-08-28T04:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: search substring  from vareity of string</title>
      <link>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/787446#M96932</link>
      <description>&lt;P&gt;JSL might not have all the flags (&lt;LI-MESSAGE title="Regex: add options for all flags" uid="687607" url="https://community.jmp.com/t5/JMP-Wish-List/Regex-add-options-for-all-flags/m-p/687607#U687607" 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-MESSAGE title="Add flag to Regex Match() to find all non-overlapping occurances of pattern" uid="582080" url="https://community.jmp.com/t5/JMP-Wish-List/Add-flag-to-Regex-Match-to-find-all-non-overlapping-occurances/m-p/582080#U582080" 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;) but it does still accept similar patterns. Use something like &lt;A href="https://regex101.com/" target="_blank"&gt;https://regex101.com/ &lt;/A&gt;to test your regex patterns (if you are not sure if they will send data to some server, do not use real data unless you can share it) and then try it in JSL. Websites like regex101 explain the pattern to you. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't have proper definition on your error codes so I cannot provide good patterns to start with. I only know it starts with 0x but I would need to know allowed characters, is there any order for these allowed characters and how to determine when it ends (and length if there is one).&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 05:29:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/787446#M96932</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-28T05:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: search substring  from vareity of string</title>
      <link>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/791241#M97030</link>
      <description>&lt;P&gt;today I took some time to read the&amp;nbsp;&lt;SPAN&gt;Definition and Examples of the Regex() function is found in the Scripting Index, and learned Regex pattern structure like&amp;nbsp;([a-zA-Z])\s([0-9]). it's wonderful sharing that&amp;nbsp; using&amp;nbsp;&lt;A href="https://regex101.com/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://regex101.com/&amp;nbsp;&lt;/A&gt;tests the regex patterns.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regex() or Regex match() is a little complicated function. I need to find more examples from the community to practice the usage of Regex().&amp;nbsp; thank you very much for your sharing of the links.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2024 08:16:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/search-substring-from-vareity-of-string/m-p/791241#M97030</guid>
      <dc:creator>ReliabilityWolf</dc:creator>
      <dc:date>2024-08-30T08:16:49Z</dc:date>
    </item>
  </channel>
</rss>

