---
title: digit
framework: swift
role: symbol
role_heading: Type Property
path: swift/regexcomponent/digit
---

# digit

A character class that matches any digit.

## Declaration

```swift
static var digit: CharacterClass { get }
```

## Discussion

Discussion This character class is equivalent to \d in regex syntax.

## See Also

### Matching substring sequences

- [anyOf(_:)](swift/regexcomponent/anyof(_:)-3pexl.md)
- [anyOf(_:)](swift/regexcomponent/anyof(_:)-4xgea.md)
- [any](swift/regexcomponent/any.md)
- [anyGraphemeCluster](swift/regexcomponent/anygraphemecluster.md)
- [anyNonNewline](swift/regexcomponent/anynonnewline.md)
- [hexDigit](swift/regexcomponent/hexdigit.md)
- [word](swift/regexcomponent/word.md)
