Skip to content

Incorrect regex generated for patterns with ** #64

@Crell

Description

@Crell

I'm trying to filter some paths, where I want to use **. Unfortunately, the regex that's getting computed internal to Glob::filter() seems to be incorrect.

For example, the pattern /** compiles to ~^/[^/]*[^/]*$~. That will match /, /foo, /bar, but not /foo/bar. I believe it should be matching /foo/bar.

Similarly, the pattern /foo/** compiles to ~^/foo/[^/]*[^/]*$~. That will match /foo, /foo/bar, but not /foo/bar/baz.

So either there is a bug in the regex compiler in handling **, or I'm not understanding ** properly. I suppose either is possible. If there is some other way I should be doing this, please advise. (In practice I think I only need prefix-matching, but was trying to use a full glob for it for flexibility.)

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