skip-regex is a lightweight, zero-dependency JavaScript utility designed for the highly accurate and fast detection of literal regular expressions within a string. It is currently at version 1.0.2, with its last release in December 2018, indicating an abandoned or maintenance status rather than active development. The library provides a single function, `skipRegex(source: string, start: number)`, which identifies the end position of a regex given a starting slash. Its key differentiators include a minimal footprint, compatibility across NodeJS, various bundlers, and browsers (including IE9+), and comprehensive TypeScript definitions. This makes it suitable for parsing or code analysis tools that need to distinguish between division operators, comments, and regex literals reliably.
npm install skip-regexVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to iterate through a string to find and extract all literal regular expressions using `skipRegex`, differentiating them from division operators or comment starts.
Always ensure `source[start] === '/'` before calling `skipRegex(source, start)`. Use `source.indexOf('/')` to find valid starting points for a potential regex.Enable `esModuleInterop: true` in your `tsconfig.json` or change the import statement to `import skipRegex = require('skip-regex')`.No dependency data recorded yet.