import { createRegExp, exactly, oneOrMore, digit } from 'magic-regexp'createRegExp( oneOrMore(digit) .as('major') .and('.') .and(oneOrMore(digit).as('minor')) .and(exactly('.').and(oneOrMore(char).as('patch')).optionally()))// /(?<major>(\d)+)\.(?<minor>(\d)+)(\.(?<patch>(.)+))?/
import assert from 'node:assert'import { createRegExp, word, char, oneOrMore } from 'magic-regexp'const TENET_RE = createRegExp( wordChar .as('firstChar') .and(wordChar.as('secondChar')) .and(oneOrMore(char)) .and.referenceTo('secondChar') .and.referenceTo('firstChar'))// /(?<firstWord>\w)(?<secondWord>\w).+\k<secondWord>\k<firstWord>/assert.equal(TENET_RE.test('TEN<==O==>NET'), true)