cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
ReliabilityWolf
Level III

search substring from vareity of string

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. 

ReliabilityWolf_0-1724685518572.png

 

12 REPLIES 12
txnelson
Super User

Re: search substring from vareity of string

Given the sample data table you provided, the formula to pull out the 1st error code using the Regex() function is

Regex( :Failure, "[A-Z]+\d+[A-Z]?" )

The Definition and Examples of the Regex() function is found in the Scripting Index 

Jim
jthi
Super User

Re: search substring from vareity of string

JSL might not have all the flags (Regex: add options for all flags ,Add flag to Regex Match() to find all non-overlapping occurances of pattern ) but it does still accept similar patterns. Use something like https://regex101.com/ 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.

 

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).

-Jarmo
ReliabilityWolf
Level III

Re: search substring from vareity of string

today I took some time to read the Definition and Examples of the Regex() function is found in the Scripting Index, and learned Regex pattern structure like ([a-zA-Z])\s([0-9]). it's wonderful sharing that  using https://regex101.com/ tests the regex patterns. 

Regex() or Regex match() is a little complicated function. I need to find more examples from the community to practice the usage of Regex().  thank you very much for your sharing of the links.