- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
extract a particular sting
Hi,
I want to extract the bin values from the rows and store in the list.
For example-
BIN = "B" 8 "Bad Bump" -> I want to extract letter "B" from the string and store in the list
BIN = "P" 6153 "PCM" -> I want to extract letter "P" from the string and store in the list and likewise for all the rows containing bin
Here is what I tried so far. It only extracts the row 13
Names Default To Here( 1 );
Clear Globals();
Clear Log();
dt = current data table();
asa = dt << Get Rows Where (Contains(as column(3), "BIN") & Contains(as column(3), "NULL") == 0);
binlist = {};
startrownumber= asa[1];
for(k =1, k<= Nitems(asa), k++,
Insertinto(binlist, db_test:Bins[asa])
);
binvaluelist= {};
for (i = startrownumber, i <= nitems(asa), i++,
newlist = dt:Bins[i];
word_list = words(newlist, "\!"\!"");
insertinto(binvaluelist, word_list);
);
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: extract a particular sting
If this is related to text parsing from Import x and y values from the text file to jmp table and create wafer map I would use different approach. But let's assume that we start with the existing data table.
I would most likely use Regex if the pattern stays always the same:
Names Default To Here(1);
dt = Open("$DOWNLOADS/Bin table.jmp");
bins = {};
bin_rgx = "\[(?:BIN = \")(.*)(?:\" \d*)]\";
For Each Row(dt,
If(Starts With(:Bins, "BIN = "),
bin_str = Regex(:Bins, bin_rgx, "\1");
Insert Into(bins, bin_str);
);
);
show(bins); // bins = {".", "1", "2", "B", "P", "N", "A", "3", "F"};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: extract a particular sting
If this is related to text parsing from Import x and y values from the text file to jmp table and create wafer map I would use different approach. But let's assume that we start with the existing data table.
I would most likely use Regex if the pattern stays always the same:
Names Default To Here(1);
dt = Open("$DOWNLOADS/Bin table.jmp");
bins = {};
bin_rgx = "\[(?:BIN = \")(.*)(?:\" \d*)]\";
For Each Row(dt,
If(Starts With(:Bins, "BIN = "),
bin_str = Regex(:Bins, bin_rgx, "\1");
Insert Into(bins, bin_str);
);
);
show(bins); // bins = {".", "1", "2", "B", "P", "N", "A", "3", "F"};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: extract a particular sting
Thanks Jarmo. It works
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: extract a particular sting
I tried on a different wafer and it doesn't work for some bins
BINS = 4
BIN = "A" 2 "Alignment_Die"
BIN = "C" 28615 "D1QM1804101"
BIN = "D" 23501 "D1QM1804102"
BIN = "F" 0 "Fail" ""
BIN = "N" 0 "Not Tested"
BIN = "P" 2806 "PCM die" ""
bins = {"A", "C", "D", "F\!" 0 \!"Fail", "N", "P\!" 2806 \!"PCM die"};
dt = current data table();
bins = {};
bin_rgx = "\[(?:BIN = \")(.*)(?:\" \d*)]\";
For Each Row(dt,
If(Starts With(:Bins, "BIN = "),
bin_str = Regex(:Bins, bin_rgx, "\1");
Insert Into(bins, bin_str);
);
);
show(bins); // bins = {"A", "C", "D", "F\!" 0 \!"Fail", "N", "P\!" 2806 \!"PCM die"};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: extract a particular sting
I would suggest testing out the regex either on JMP or on https://regex101.com/r/DPngn1/1 . Choose one failing string and then test it out to see how and why it fails. In this case my regex pattern does require slight modification as it sometimes matches too much.