---
title: "pattern(_:)"
framework: foundationmodels
role: symbol
role_heading: Type Method
path: "foundationmodels/generationguide/pattern(_:)"
---

# pattern(_:)

Enforces that the string follows the pattern.

## Declaration

```swift
static func pattern<Output>(_ regex: Regex<Output>) -> GenerationGuide<String>
```
