Skip to content

Support for negative lookahead #365

@AshutoshNirkhe

Description

@AshutoshNirkhe

Hello,

I have a use case where I want to build a regex which will match a certain pattern of strings and will not contain a particular word at the end of string. For example, docker image should come from a allowed list of container registries and the image shouldn't be the 'latest' tag (i.e. image name shouldn't end in ':latest').
For example: regex should match 'docker.io/fluent-bit:1.2.1' but not 'docker.io/fluent-bit:latest'

Context: I am using a security policy tool that works on top of Rego from Open Policy Agent and Rego seems to be using this library under the hood. I can see 'negative lookahead' is not supported as per https://github.com/google/re2/blob/main/doc/syntax.txt#L83
Any specific reason why this is not supported ? If it can't be, then could you suggest any alternative regex logic to handle such use case ?
Thanks!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions