Between_strings with text with quotes in it

I am looking to use between_strings to extract text that is inside quotation marks. Given the text:

“hostname”: “admins-MacBook-Pro.local”

I want to extract:

admins-MacBook-Pro.local

How do I get the system to explicitly use the quote mark and not treat it as a text delimiter?

Hi @KeithTessler

You can use single quotes or double quotes. Here’s a brief write-up about that:

https://docs.mspintegrations.com/text_replacement/text-helpers#denoting-strings-with-quote-marks

Since your string has double quotes, use single quotes as your delimiters:

{{between_strings email.body '"hostname": "' '"'}}

It’s hard to see, but each of the two strings are surrounded by a single quote.

Sounds easy, thanks!!!

For the sake of anyone else who comes across this thread, you could also use two “Render Text and Store as Variable” steps to define the strings first. This would allow you to completely avoid the quote problem (and would be helpful if your string had both types of quotes).

For example, you could have the first Render Text and Store As Variable step configured to store this as custom.start:

"hostname": "

And the second one configured to store this as custom.end:

"

Then, in your rule, you could use this expression to find text between both strings:

{{between_strings email.body custom.start custom.end}}