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

    Variable h2rConst

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

    Quick human-to-regex conversion with abbreviated syntax. This compact alias for parseHumanTextToRegex provides the same powerful natural language processing in a shortened form ideal for rapid development and inline pattern generation.

    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.

    Concise natural language pattern description. Same capabilities as the full function: complex patterns, compound requirements, positional constraints, and specialized domain patterns (email, phone, etc.)

    Optional validation string for confidence boosting and accuracy testing. When provided, tests the generated pattern and adjusts confidence accordingly.

    Standard TextExtractionResult with full pattern generation results:

    • success: Pattern generation success indicator
    • pattern: Generated RegExp object for immediate use
    • confidence: Reliability score from 0.0 to 1.0
    • description: Clear explanation of pattern behavior
    • suggestions: Improvement recommendations and usage tips
    // Quick email pattern
    const email = h2r("email");

    // Rapid validation setup
    const phone = h2r("US phone", "+1-555-0123");
    if (phone.success && phone.confidence > 0.8) {
    // Use phone.pattern for validation
    }

    // Inline pattern generation
    const isValid = h2r("starts with A ends with Z").pattern?.test("AMAZING");