cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • DownloadSemiconductor Toolkit: Tools to create wafer maps, add wafer geometry to graphics, explore die defects & compare wafers.
  • Discovery Summit 2026: Early User Edition - September 23-24.Register. It's free.
  • See how to use JMP Pro to analyze and predict using entire data set rather than selected points in a curve. Register for Nov. 6 Mastering JMP.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
fionaweston
Level III

How do I extract only the text that is between quotation marks

I have a column containing 1000's of Machine Error Codes which are typed in by an operator at the machine.

Most of the errors do not have quotation marks but for those that do I would like to be able to extract what is between the quotation marks.

For other special characters I can use the escape character but I'm having problems using this with the quotation marks.

Thanks in advance

Fiona

 

Example 1: *******The unit is giving a “no scanner connection” error. Unit is INOP.
Example 2: ********P1-“Waiting for system authentication”, unable to run ******* Area C
Example 3: *********Now reads “X-ray error"

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How do I extract only the text that is between quotation marks

There seems to be at least three different kinds of quotes in the example dataset (“ " ”).

 

Example script here should handle at least all of those.

Names Default To Here(1);
dt = New Table("Error Codes Quotations",
	Add Rows(3),
	Compress File When Saved(1),
	New Column("Error Code",
		Character,
		"Nominal",
		Set Values(
			{
			" ****  The unit is giving a “no scanner connection” error.  Unit is INOP.",
			"P1-“Waiting for system authentication”, unable to run  ******* Area C",
			"Now reads “X-ray error\!""}
		)
	)
);

dt << New Column("BetweenQuotes_Regex", Character, Nominal, << Formula(
	Regex(:Error Code, "[“|\!"|'](.*?)[”|\!"|']");
));
dt << New Column("BetweenQuotes_Word", Character, Nominal, << Formula(
	Word(2, :Error Code, "”“\!"")
));
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: How do I extract only the text that is between quotation marks

There seems to be at least three different kinds of quotes in the example dataset (“ " ”).

 

Example script here should handle at least all of those.

Names Default To Here(1);
dt = New Table("Error Codes Quotations",
	Add Rows(3),
	Compress File When Saved(1),
	New Column("Error Code",
		Character,
		"Nominal",
		Set Values(
			{
			" ****  The unit is giving a “no scanner connection” error.  Unit is INOP.",
			"P1-“Waiting for system authentication”, unable to run  ******* Area C",
			"Now reads “X-ray error\!""}
		)
	)
);

dt << New Column("BetweenQuotes_Regex", Character, Nominal, << Formula(
	Regex(:Error Code, "[“|\!"|'](.*?)[”|\!"|']");
));
dt << New Column("BetweenQuotes_Word", Character, Nominal, << Formula(
	Word(2, :Error Code, "”“\!"")
));
-Jarmo
fionaweston
Level III

Re: How do I extract only the text that is between quotation marks

Thank you. This works great!!

Recommended Articles