---
title: "anyOf(_:)"
framework: swift
role: symbol
role_heading: Type Method
path: "swift/regexcomponent/anyof(_:)-3pexl"
---

# anyOf(_:)

Returns a character class that matches any Unicode scalar in the given sequence.

## Declaration

```swift
static func anyOf<S>(_ s: S) -> CharacterClass where S : Sequence, S.Element == Unicode.Scalar
```

## Discussion

Discussion Calling this method with a group of Unicode scalars is equivalent to listing them in a custom character class in regex syntax.

## See Also

### Matching substring sequences

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