method PatternBuilder.yamlVersion
PatternBuilder.yamlVersion(quoted?:
"single"
| "double"
| "both"
| "none"
): RegExp

Build a safe YAML version pattern

Examples

Example 1

// Matches version with any quote style
const pattern = PatternBuilder.yamlVersion('both');
// Returns: /^(\s*version:\s*)(['"]?)([^'"\n]+)(['"]?)$/m

Parameters

optional
quoted:
"single"
| "double"
| "both"
| "none"
= 'both'
  • Quote style to match

Return Type

RegExp

Safe regex pattern for YAML version fields

Usage

import { PatternBuilder } from ".";