Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Regex not matching email message

Rob Waterhouse August 3, 2022

We have the following email (included at the bottom) where we want to extract two key pieces of information.

The first is "Monitor: Service - SERVICENAME - Running State"

The second is "Stopped" (which could be anything from "99.9%", "Started", "Stopped", "Running", "1.230s"

These two blocks are the only pieces of information we want going into our alert.

 

I have tried several regex attempts to extract this data, but only the top one works. 

I believe the second regex is not working due to the use of newlines. It's the only thing that differs between the two statements.

Here is my latest attempt at the extract. This code is in the description field of an email integration.

Monitor: {{message.extract(/Monitor: (.+)/)}}
Value: {{message.extract(/Monitor: .+\n+(.+)/)}}

Please could someone point me to where I am going wrong.

Thanks you

Click on [Body.html] attachment for HTML version




Log in to Stackify



Critical
View in Retrace
SERVERNAME (SERVERENVIRONMENT)
Monitor: Service - SERVICENAME - Running State






Stopped


Alerts



Associations
Started
State






SERVICENAME
Wednesday, August 3, 2022 12:13
Critical









Netreo, 7171 Warner Ave. Suite B787, Huntington Beach, CA 92647, USA


© 2022 Netreo | All Rights Reserved

 

1 answer

0 votes
Muhammad Zeeshan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 4, 2022

Hey Rob,

I have responded to your query in the Support Ticket you opened also. Basically this is what I would like you to for the second one:

Value: {{message.extract(/Monitor: .\s(.+)/)}}

If that does not work could you please just add message in the Description field and create a test alert?

MUHAMMAD ZEESHAN
Technical Support Engineer

Muhammad Zeeshan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 4, 2022

Apologies, the regex got reformatted. Here is the correct one:

{{Value: \{{message.extract(/Monitor: .+\s+(.+)/)}}}}
Afonso Henrique Rodrigues Alves August 9, 2022

@Muhammad Zeeshan Could you point to the latest regex documentation? 

Muhammad Zeeshan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 10, 2022
Afonso Henrique Rodrigues Alves August 10, 2022
Like Muhammad Zeeshan likes this
Muhammad Zeeshan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 10, 2022

@Afonso Henrique Rodrigues Alves You're most welcome! :)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events