ts-regex-builder
Version:
Maintainable regular expressions for TypeScript and JavaScript.
13 lines • 620 B
JavaScript
import { buildRegExp } from "../builders.mjs";
import { endOfString, startOfString, wordBoundary } from "../constructs/anchors.mjs";
import { choiceOf } from "../constructs/choice-of.mjs";
import { repeat } from "../constructs/repeat.mjs";
const hexDigit = /[0-9a-f]/;
export const hexColorFinder = buildRegExp(['#', choiceOf(repeat(hexDigit, 6), repeat(hexDigit, 3)), wordBoundary], {
ignoreCase: true,
global: true
});
export const hexColorValidator = buildRegExp([startOfString, '#', choiceOf(repeat(hexDigit, 6), repeat(hexDigit, 3)), endOfString], {
ignoreCase: true
});
//# sourceMappingURL=hex-color.mjs.map