The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Regex not matching email message

Rob Waterhouse (MPP)
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
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

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

@Zeeshan Could you point to the latest regex documentation? 

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

@Zeeshan Thanks!

Like Zeeshan likes this
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! :)

DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events