RGex Builder Platform - v1.2.0
    Preparing search index...

    Variable t2rConst

    t2r: (humanText: string, testValue?: string) => TextExtractionResult = parseHumanTextToRegex

    Efficient text-to-regex transformation with streamlined syntax. This abbreviated alias for parseHumanTextToRegex maintains full functionality while providing a more concise interface for frequent pattern generation tasks and integration into larger text processing workflows.

    Type declaration

      • (humanText: string, testValue?: string): TextExtractionResult
      • Parses a human-readable string to generate a regular expression. It first attempts to find complex, compound patterns, then looks for direct keyword matches, and finally falls back to constructing a pattern from individual text components.

        Parameters

        • humanText: string

          The natural language string describing the desired regex.

        • OptionaltestValue: string

          An optional string to test against the generated regex for confidence scoring.

        Returns TextExtractionResult

        A TextExtractionResult object containing the generated pattern, confidence, and other metadata.

    Descriptive text specifying the desired regex pattern behavior. Supports all pattern types: simple keywords, complex multi-part requirements, length constraints, character classes, and specialized format patterns.

    Optional test input for pattern validation and confidence calculation. Enables immediate verification that the generated pattern works as expected.

    Complete TextExtractionResult object with comprehensive pattern data:

    • success: Whether text parsing and pattern generation succeeded
    • pattern: Ready-to-use RegExp object (undefined if generation failed)
    • confidence: Numerical confidence score indicating pattern reliability
    • description: Human-readable explanation of the pattern's matching behavior
    • suggestions: Actionable advice for pattern improvement or troubleshooting
    // Compact pattern creation
    const uuid = t2r("uuid format");
    const valid = uuid.pattern?.test("550e8400-e29b-41d4-a716-446655440000");

    // Quick validation pipeline
    const result = t2r("alphanumeric 8-16 chars", "password123");
    console.log(`Confidence: ${result.confidence}, Valid: ${result.success}`);

    // Streamlined error handling
    const pattern = t2r("complex requirement").pattern || /fallback/;