Is it possible to use Regex in a Group or AppliesTo filter?
Hi,
I need to filter a specific number of machines into a group or datasource. The filter is any machine that has the letter ‘c’ as the second-to-last character before the first period in a name. E.g. abc1.company.com.
I have some Regex that will do this ( [^.]*c[^.]\.[^.]*\.[^.] ), but when I try to use it in an AppliesTo it just fails.
According to this page: https://www.logicmonitor.com/support/terminology-syntax/scripting-support/what-is-lms I should be able to use =~ or !~ but they both give errors like this:
I tried putting it in quotes, parenthesis, quotes and parenthesis, and I couldn’t get it to work. I opened a ticket and they are going to look into it, but I thought I’d post here in case anyone knew if this is possible or not and how to make it work.
Thanks!
Hi Kelemvor,
The dots that need to be used as literal characters need to be escaped with \\, for your example its the dots outside the square brackets. Can you try the below?
"[^.]*c[^.]\\.[^.]*\\.[^.]"
Relevant mention in the AppliesTo article https://www.logicmonitor.com/support/terminology-syntax/scripting-support/what-is-lms#usage-notes