Repository: grafana/grafana-zabbix

Issue:
v6.0.0: "error parsing regexp: pattern too long" occurs when selecting 'ALL' for an item variable
**Describe the bug**
After updating the Grafana-Zabbix plugin from v5.2.1 to v6.0.0, an error occurs. This error happens when selecting the `ALL` option in a dashboard variable that is configured to list Zabbix items.

The error message is `error parsing regexp: pattern too long (max 1000 characters)`.

This suggests there's a new or changed limitation on the length of the regular expression used to filter Zabbix items when `ALL` is selected. The issue was confirmed across different Zabbix versions (7.4.2 and 7.0.10). Downgrading the plugin back to v5.2.1 resolves the problem, which strongly indicates the issue lies within the v6.0.0 release of this plugin.

**Expected behavior**
When selecting the `ALL` option for the Zabbix items variable, the dashboard should successfully query and display data for all items without any errors, just as it did with plugin version v5.2.1. The generated regular expression, even if very long, should be handled correctly.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Network data**
The following is the raw query and response from the browser's developer tools. Some sensitive information has been masked.

**Request Body:**
```json
{
    "queries": [
        {
            "application": {
                "filter": "Traffic"
            },
            "countTriggersBy": "",
            "datasource": {
                "type": "alexanderzobnin-zabbix-datasource",
                "uid": "abcdifghijk" # Masked
            },
            "evaltype": "0",
            "functions": [],
            "group": {
                "filter": "/^ALL$/"
            },
            "host": {
                "filter": "/^hostname$/" # Masked
            },
            "item": {
                "filter": "/^(Interface Ethernet1\\(\\): Bits received|Interface Ethernet1\\(\\): Bits sent|Interface Ethernet2\\(\\): Bits received)$/"　# Masked many string (1930 words)
            },
            "itemTag": {
                "filter": ""
            },
            "macro": {
                "filter": ""
            },
            "options": {
                "count": true,
                "disableDataAlignment": false,
                "minSeverity": 3,
                "showDisabledItems": true,
                "skipEmptyValues": false,
                "useTrends": "default",
                "useZabbixValueMapping": false
            },
            "proxy": {
                "filter": ""
            },
            "queryType": "0",
            "refId": "A",
            "resultFormat": "time_series",
            "schema": 12,
            "table": {
                "skipEmptyValues": false
            },
            "tags": {
                "filter": ""
            },
            "textFilter": "",
            "trigger": {
                "filter": ""
            },
            "triggers": {
                "acknowledged": 2
            },
            "datasourceId": 55,
            "intervalMs": 1000,
            "maxDataPoints": "3000"
        }
    ],
    "range": {
        "to": "2025-09-22T08:18:28.219Z",
        "from": "2025-09-22T07:18:28.219Z",
        "raw": {
            "from": "now-1h",
            "to": "now"
        }
    },
    "from": "1758525508219",
    "to": "1758529108219"
}
```

**Response Body:**
```json
{
    "results": {
        "A": {
            "error": "error parsing regexp: pattern too long (max 1000 characters)",
            "errorSource": "downstream",
            "status": 500,
            "frames": []
        }
    }
}
```

**Software versions**

| Grafana | Zabbix | Grafana-Zabbix Plugin |
| --- | --- | --- |
| 12.1.1 | 7.4.2 and 7.0.10 | 6.0.0 |


Discussion:
@zoltanbedi: Thanks for the feedback @penM000 I'm going to remove the length restriction. It will be fixed in the next version.@penM000: Thank you for the quick bug fix!
I have confirmed it is working properly in my environment.@zoltanbedi: Awesome! thanks for confirming.

Solution patch:
diff --git a/.changeset/soft-kids-watch.md b/.changeset/soft-kids-watch.md
new file mode 100644
index 0000000..3f34ccd
--- /dev/null
+++ b/.changeset/soft-kids-watch.md
@@ -0,0 +1,5 @@
+---
+'grafana-zabbix': patch
+---
+
+Fix: Remove regex pattern length restriction
diff --git a/pkg/zabbix/utils.go b/pkg/zabbix/utils.go
index 6afa87e..e97657b 100644
--- a/pkg/zabbix/utils.go
+++ b/pkg/zabbix/utils.go
@@ -155,11 +155,6 @@ func parseFilter(filter string) (*regexp2.Regexp, error) {
 		return nil, backend.DownstreamErrorf("error parsing regexp: potentially dangerous regex pattern detected")
 	}
 
-	// Security: Limit regex pattern length
-	if len(regexPattern) > 1000 {
-		return nil, backend.DownstreamErrorf("error parsing regexp: pattern too long (max 1000 characters)")
-	}
-
 	pattern := ""
 	if matches[2] != "" {
 		if flagRE.MatchString(matches[2]) {



Test patch:
diff --git a/pkg/zabbix/utils_test.go b/pkg/zabbix/utils_test.go
index 02e6f37..697a39f 100644
--- a/pkg/zabbix/utils_test.go
+++ b/pkg/zabbix/utils_test.go
@@ -2,7 +2,6 @@ package zabbix
 
 import (
 	"reflect"
-	"strings"
 	"testing"
 
 	"github.com/dlclark/regexp2"
@@ -124,13 +123,6 @@ func TestParseFilter(t *testing.T) {
 			expectNoError: false,
 			expectedError: "error parsing regexp: potentially dangerous regex pattern detected",
 		},
-		{
-			name:          "Pattern too long",
-			filter:        "/" + strings.Repeat("a", 1001) + "/",
-			want:          nil,
-			expectNoError: false,
-			expectedError: "error parsing regexp: pattern too long (max 1000 characters)",
-		},
 		{
 			name:          "Safe complex regex",
 			filter:        "/^[a-zA-Z0-9_-]+\\.[a-zA-Z]{2,}$/",