chalk / ansi-regex

Regular expression for matching ANSI escape codes
MIT License
184 stars 79 forks source link

Allowing regex to match only first #23

Closed ZSkycat closed 6 years ago

ZSkycat commented 6 years ago

When I only need to find the first one, I don't need g flag.

scenes to be used: https://github.com/ZSkycat/ghost-progress-webpack-plugin/blob/master/src/helper.ts#L80

sindresorhus commented 6 years ago

Sounds like a valid use-case. I don't think it should accept regex flags though, but rather an option called onlyFirst to match only the first item.

ZSkycat commented 6 years ago

Agree, I will modify my commit