Quick-and-dirty semver

import { createRegExp, exactly, oneOrMore, digit, char } from 'magic-regexp'createRegExp(  oneOrMore(digit)    .groupedAs('major')    .and('.')    .and(oneOrMore(digit).groupedAs('minor'))    .and(exactly('.').and(oneOrMore(char).groupedAs('patch')).optionally()))// /(?<major>\d+)\.(?<minor>\d+)(?:\.(?<patch>.+))?/

References to previously captured groups using the group name

import assert from 'node:assert'import { createRegExp, wordChar, char, oneOrMore } from 'magic-regexp'const TENET_RE = createRegExp(  wordChar    .groupedAs('firstChar')    .and(wordChar.groupedAs('secondChar'))    .and(oneOrMore(char))    .and.referenceTo('secondChar')    .and.referenceTo('firstChar'))// /(?<firstChar>\w)(?<secondChar>\w).+\k<secondChar>\k<firstChar>/assert.equal(TENET_RE.test('TEN<==O==>NET'), true)