micromatch / picomatch

Blazing fast and accurate glob matcher written JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. Used by GraphQL, Jest, Astro, Snowpack, Storybook, bulma, Serverless, fdir, Netlify, AWS Amplify, Revogrid, rollup, routify, open-wc, imba, ava, docusaurus, fast-glob, globby, chokidar, anymatch, cloudflare/miniflare, pts, and more than 5 million projects! Please follow picomatch's author: https://github.com/jonschlinkert
https://github.com/micromatch
MIT License
972 stars 56 forks source link

The actual result of toRegex dosen't match the document,missing symbol ^$ #130

Open EAGzzyCSL opened 8 months ago

EAGzzyCSL commented 8 months ago

document example

link: toRegex

const picomatch = require('picomatch');
// picomatch.toRegex(source[, options]);

const { output } = picomatch.parse('*.js');
console.log(picomatch.toRegex(output));
//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/

actual result

image

missing symbol ^ & $ and with other differences

- /^(?:(?!\.)(?=.)[^/]*?\.js)$/
+ /(?!\.)(?=.)[^/]*?\.js/

version

both v3 and v4