Help with Event Rule RegEx

George18
Tera Expert

Hi,

 

I am trying to create a RexEx to be used inside an Event Rule.

My Regex works correctly when I test it with Regex101.com but I obtain an error message UNKNOW when using in my Event Rule. Unknown is displayed when I output the variable which contains my RegEx

 

Here is the Regex which works on Regex101

.*Azure SQL Database: (.*)\/.*

 

 

Here is a sample text:

Blablatoto

sql-test-MY-mssqllab/MyInstance The Data space used percent value of 77 % was above your custom threshold of 75 %.Azure SQL Database: sql-test-MY-mssqllab/MyInstance
Blablabla

 

-------------------------------------------------------------------------------------------------------------------------------------

 

I want to extract the name of the DB, it can be found of the keyword Azure SQL Database: 

But I want to grab everything after Azure SQL Database: up until the /

 

Thank you

1 ACCEPTED SOLUTION

Appli
Mega Sage
Mega Sage

Hi, Can you try with regex below?

(.+Azure SQL Database: )(.+?)(\/.*)
Hope it helps

View solution in original post

3 REPLIES 3

Appli
Mega Sage
Mega Sage

Hi, Can you try with regex below?

(.+Azure SQL Database: )(.+?)(\/.*)
Hope it helps

George18
Tera Expert

Thank you for the quick reply Appli. Do you have any tricks on RegEx from ServiceNow?

So many times my RegEx works in Reg101, and then does not work inside ServiceNow.

 

Thanks again

Hi, you are welcome! I believe in your regex, this part "(.*)was wrong as it also captures the slash "/".

Hope it helps