Skip to content

Regex label filter return wrong result #14433

@hket-tommyluk

Description

@hket-tommyluk

Describe the bug
Regex selector filter should works exactly like Prometheus label matchers but it not.

the =~ and !~ regex operators are fully anchored.

So "1234" =~ "23.*" should return false, same as "1234" =~ ".*23".

Query

{foo="bar"}
{foo="bar"} | label_format test="1234" | test=~"1234"
{foo="bar"} | label_format test="1234" | test=~"23.*"
{foo="bar"} | label_format test="1234" | test=~".*23"

Expected behaviour
The first two queries should return all lines but last two queries return no lines.

Actual behaviour
All four queries return all lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomehing is not working as expected

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions