---
title: substring
framework: swift
role: symbol
role_heading: Instance Property
path: swift/anyregexoutput/element/substring
---

# substring

The slice of the input which was captured, if there was a capture.

## Declaration

```swift
var substring: Substring? { get }
```

## Discussion

Discussion If nothing was captured, substring is nil.
