From 5047c79e71a336da1fa2e0b8fc6e50811801f878 Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Thu, 18 Jul 2019 13:10:37 -0400 Subject: support podman ps filter regular expressions podman ps --filter use regexp to match the container name. Signed-off-by: Qi Wang --- cmd/podman/shared/container.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cmd/podman/shared') diff --git a/cmd/podman/shared/container.go b/cmd/podman/shared/container.go index 3c68a29b4..5492f843f 100644 --- a/cmd/podman/shared/container.go +++ b/cmd/podman/shared/container.go @@ -296,7 +296,11 @@ func generateContainerFilterFuncs(filter, filterValue string, r *libpod.Runtime) }, nil case "name": return func(c *libpod.Container) bool { - return strings.Contains(c.Name(), filterValue) + match, err := regexp.MatchString(filterValue, c.Name()) + if err != nil { + return false + } + return match }, nil case "exited": exitCode, err := strconv.ParseInt(filterValue, 10, 32) -- cgit v1.2.3-54-g00ecf