Skip to content

Regular Expression support for --xpath #2990

@FredericoCoelhoNunes

Description

@FredericoCoelhoNunes

Hello,

I believe --xpath does not support filtering by regular expressions.

Use case:
I have the following metrics file:

{
  "groups": [
    {
      "name": "group-A-1",
      "metrics": ...
    },
    {
      "name": "group-A-2",
      "metrics": ...
    },
    {
      "name": "group-B-1",
      "metrics": ...
    },
}

and would like to get all groups from the A segment, but not the B segment.
Ideally, this would work:
dvc metrics show -x $.groups[?(@.name =~ /group-A-*/)]

Right now, only the == operator is supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions