ranges(of:)
Finds and returns the ranges of the all occurrences of a given sequence within the collection.
- iOS
- 16.0+
- macOS
- 13.0+
- tvOS
- 16.0+
- watchOS
- 9.0+
func ranges(of regex: some RegexComponent) -> [Range<Self.Index>]
Parameters
- regex
The regex to search for.
Returns
A collection or ranges in the receiver of all occurrences of regex
. Returns an empty collection if regex
is not found.