TL;DR: here is the glob pattern: @(0|[1-9]*([0-9])).@(0|[1-9]*([0-9])).@(0|[1-9]*([0-9]))?(-@(*([0-9])[a-zA-Z-]*([a-zA-Z0-9-])|0|[1-9]*([0-9]))*(.@(*([0-9])[a-zA-Z-]*([a-zA-Z0-9-])|0|[1-9]*([0-9]))))?(++([a-zA-Z0-9-])*(.+([a-zA-Z0-9-])))
This project detects versions following SemVer 2.0. The generator is based on the Backus–Naur form grammar defined by SemVer 2.0.
In order to test locally, run the following commands:
npm install
npm test
npm run generatenpm test checks the generated pattern against the SemVer valid and invalid test vectors. npm run generate prints the pattern and its length. The current pattern is 204 characters long.