[ZBX-22086] User macros with context throws preg_match(): Unknown modifier '0' Created: 2022 Dec 14  Updated: 2024 Apr 22  Resolved: 2024 Apr 22

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 6.2.5
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Julien Lacasse-Roger Assignee: Zabbix Development Team
Resolution: False Positive Votes: 0
Labels: macro, macrocontext, regex
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File zabbix_error.png     PNG File zabbix_regex_macro.png    
Team: Team A
Sprint: Support backlog

 Description   

Steps to reproduce:

Apply a template such as "Cisco IOS SNMP" to host.
Configure a user macros with context such as in screenshot

 

{$IFCONTROL:regex:"^(Gi[1-2]\/0\/(1[3-9]|2[0-9]|3[0-6]))$"} => 0

 

Similar to ZBX-18209

Result:

Each time a trigger where regex is False (ie interface name Gi1/0/12) the error shown in screenshot is triggered in "Problems" and "Dashboard".

No issue if regex is True (trigger is ignored as expected).

Expected:

No error, triggers normally. 



 Comments   
Comment by Julien Lacasse-Roger [ 2024 Jan 04 ]

Still an issue with 6.4.10

Comment by Andrejs Verza [ 2024 Apr 22 ]

Slashes shall not be escaped by backslashes in regular expressions. Please correct the provided example to:

{$IFCONTROL:regex:"^(Gi[1-2]/0/(1[3-9]|2[0-9]|3[0-6]))$"} => 0
Comment by Julien Lacasse-Roger [ 2024 Apr 22 ]

Yup that worked. Thank you! Would be worth adding to documentation as most regex engines require escaping forward slashes.

Generated at Fri Apr 04 14:48:38 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.