Skip to content

! pattern not working #516

@musicq

Description

@musicq

This glob pattern is not working in both version 8 and 9, however, it works in version 7.

?(drawable-!(xxxhdpi)|raw)/**/*.@(png|svg|jpg)

File structure

root/
├── raw/
│   └── a.json
├── drawable-hdpi/
│   └── b.jpg
├── drawable-mdpi/
│   └── c.jpg
├── drawable-xhdpi/
│   └── d.jpg
├── drawable-xxhdpi/
│   └── e.jpg
└── drawable-xxxhdpi/
    └── f.jpg

In both 8 and 9, it will only filter the files under raw folder.

But in v7, all the images and json files can be filtered.

glob(
  '?(drawable-!(xxxhdpi)|raw)/**/*.@(png|svg|jpg)',
  {
    cwd: '/root',
    dot: true,
  },
  (error, files) => {
    if (error) {
      console.error(error)
    }

    console.log(files)
  },
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions