Regex in event rule not working

pratiksha5
Mega Sage

I am trying to write a event rule. I need to filter it on the basis of event description. If the description dose not contain IP address then this rule should execute. 

 

Regex is : .*^(?!.*\b(?:\d{1,3}\.){3}\d{1,3}\b).*

 

I validated this on https://regex101.com/

 

But the rule is executing in both the conditions. Please guide. 

 

 

10 REPLIES 10

Hi @Rahul Priyadars : Did you get time to check this?

 

Try this 

 

^([^0-9]*)$

 

Happy use Case- 

RahulPriyadars_0-1687834523853.png

 

 

_ve Use case-

RahulPriyadars_1-1687834559295.png

 

Regards

RP

This will fail even if there is any number in the description containing any number. 

 

Amit Gujarathi
Giga Sage
Giga Sage

HI @pratiksha5 ,
I trust you are doing great.

I am trying to write a event rule. I need to filter it on the basis of event description. If the description dose not contain IP address then this rule should execute. 

 

Regex is : .*^(?!.*\b(?:\d{1,3}\.){3}\d{1,3}\b).*

 

I validated this on https://regex101.com/

 

But the rule is executing in both the conditions. Please guide. 

Reference code

(function executeRule(current) {
  var eventDescription = current.description; // Assuming the event description is stored in the 'description' field

  var ipRegex = /^(?!.*\b(?:\d{1,3}\.){3}\d{1,3}\b).*/;

  if (!eventDescription.match(ipRegex)) {
    // Your code logic goes here
    // This code block will be executed only if the event description does not contain an IP address
  }

})(current);

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Hi, I do not need a script for validation. I am doing validation in the regex101.