Between strings when the content has ' in them

Hi, we are trying to extract some server names from an alert as below:

A replication job has failed to send data for ‘SERVER1’ to the Target Core SERVER2

I have configured the rule below:

{{between_strings email.body ‘for ‘’ ‘’ to’ flags=‘t’}}

However it renders the variable as ‘SERVER1’

How do we remove the ’ ?

Hi @dale

If the email contains this:

A replication job has failed to send data for ‘SERVER1’ to the Target Core SERVER2

I would expect this to return SERVER1:

{{between_strings email.body "for ‘" "‘ to" flags="t"}}

You can use single-quotes or double-quotes to surround the strings. Since you need to include single-quotes inside the string, you’ll want to surround it with double-quotes (like I have here).

This may be helpful for you: https://docs.mspintegrations.com/text_replacement/text-helpers#denoting-strings-with-quote-marks

Another idea: since the only single-quotes are the two we care about, you could even do this (but I recommend using longer strings to qualify the text):

{{between_strings "'" "'" flags="t"}}

1 Like

Ah ok. Didn’t know you could use " as well. Thanks that worked well.