Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative Look Ahead Match #4

Closed
dtothefp opened this issue Apr 14, 2023 · 1 comment
Closed

Negative Look Ahead Match #4

dtothefp opened this issue Apr 14, 2023 · 1 comment

Comments

@dtothefp
Copy link

Hi I'm trying to get a negative lookahead working but not sure if it's possible in this lib? I'm using it as part of

Escape-Technologies/mookme#59 (comment)

const matcher = require('wildcard-match');

const globs = [
  '**/*.jsx',
  '**/*.js',
  '(?!dont-match/)/**/*',
];
const match = matcher(globs)

console.log(match.regexp)

// /^(?:^(?:[^/\\]*?[/\\]+?)*?[^/\\]*?\.jsx[/\\]*?$|^(?:[^/\\]*?[/\\]+?)*?[^/\\]*?\.js[/\\]*?$|^\([^/\\]!dont\-match[/\\]+?\)[/\\]+?(?:[^/\\]*?[/\\]+?)*?[^/\\]*?[/\\]*?$)$/
@axtgr
Copy link
Owner

axtgr commented Apr 16, 2023

Hi!

This library doesn't support negation. Its purpose is to be as small and as fast as possible while supporting only the most basic glob features.

I have a more feature-packed library that has negation: outmatch. But note that the syntax is different to yours because lookahead is a feature of regexps, not globs.

@axtgr axtgr closed this as completed Apr 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants