'Invalid JSON input']); exit; } $action = $input['action'] ?? 'test'; $result = match ($action) { 'test_patterns' => $tester->testPatterns( $input['text'] ?? '', $input['patterns'] ?? [] ), 'test_processor' => $tester->testProcessor( $input['message'] ?? '', $input['context'] ?? [], $input['patterns'] ?? [], $input['field_paths'] ?? [] ), 'test_strategies' => $tester->testStrategies( $input['message'] ?? '', $input['context'] ?? [], $input['patterns'] ?? [] ), 'validate_pattern' => $tester->validatePattern($input['pattern'] ?? ''), 'get_defaults' => ['patterns' => $tester->getDefaultPatterns()], default => ['error' => 'Unknown action'], }; echo json_encode($result, JSON_PRETTY_PRINT); exit; } // Serve the HTML template $templatePath = __DIR__ . '/templates/playground.html'; if (file_exists($templatePath)) { readfile($templatePath); } else { // Fallback inline template ?>
Test regex patterns for masking sensitive data in log messages.