---
title: RegexComponent
framework: swift
role: symbol
role_heading: Protocol
path: swift/regexcomponent
---

# RegexComponent

A type that represents a regular expression.

## Declaration

```swift
protocol RegexComponent<RegexOutput>
```

## Overview

Overview You can use types that conform to RegexComponent as parameters to string searching operations and inside RegexBuilder closures.

## Topics

### Creating a regex component

- [init(_:_:)](swift/regexcomponent/init(_:_:).md)

### Getting a regex from a component

- [regex](swift/regexcomponent/regex.md)

### 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)
- [digit](swift/regexcomponent/digit.md)
- [hexDigit](swift/regexcomponent/hexdigit.md)
- [word](swift/regexcomponent/word.md)

### Matching whitespace and line endings

- [horizontalWhitespace](swift/regexcomponent/horizontalwhitespace.md)
- [newlineSequence](swift/regexcomponent/newlinesequence.md)
- [verticalWhitespace](swift/regexcomponent/verticalwhitespace.md)
- [whitespace](swift/regexcomponent/whitespace.md)

### Matching dates and times

- [date(_:locale:timeZone:calendar:)](swift/regexcomponent/date(_:locale:timezone:calendar:).md)
- [date(format:locale:timeZone:calendar:twoDigitStartDate:)](swift/regexcomponent/date(format:locale:timezone:calendar:twodigitstartdate:).md)
- [dateTime(date:time:locale:timeZone:calendar:)](swift/regexcomponent/datetime(date:time:locale:timezone:calendar:).md)
- [iso8601](swift/regexcomponent/iso8601.md)
- [iso8601Date(timeZone:dateSeparator:)](swift/regexcomponent/iso8601date(timezone:dateseparator:).md)
- [iso8601(timeZone:includingFractionalSeconds:dateSeparator:dateTimeSeparator:timeSeparator:)](swift/regexcomponent/iso8601(timezone:includingfractionalseconds:dateseparator:datetimeseparator:timeseparator:).md)
- [iso8601WithTimeZone(includingFractionalSeconds:dateSeparator:dateTimeSeparator:timeSeparator:timeZoneSeparator:)](swift/regexcomponent/iso8601withtimezone(includingfractionalseconds:dateseparator:datetimeseparator:timeseparator:timezoneseparator:).md)

### Matching numeric formats

- [localizedInteger(locale:)](swift/regexcomponent/localizedinteger(locale:).md)
- [localizedDouble(locale:)](swift/regexcomponent/localizeddouble(locale:).md)
- [localizedDecimal(locale:)](swift/regexcomponent/localizeddecimal(locale:).md)
- [localizedCurrency(code:locale:)](swift/regexcomponent/localizedcurrency(code:locale:).md)
- [localizedIntegerCurrency(code:locale:)](swift/regexcomponent/localizedintegercurrency(code:locale:).md)
- [localizedIntegerPercentage(locale:)](swift/regexcomponent/localizedintegerpercentage(locale:).md)
- [localizedDoublePercentage(locale:)](swift/regexcomponent/localizeddoublepercentage(locale:).md)

### Matching URLs

- [url(scheme:user:password:host:port:path:query:fragment:)](swift/regexcomponent/url(scheme:user:password:host:port:path:query:fragment:).md)

### Supporting types

- [RegexOutput](swift/regexcomponent/regexoutput.md)
- [RegexComponent.DateStyle](swift/regexcomponent/datestyle.md)
- [RegexComponent.TimeStyle](swift/regexcomponent/timestyle.md)

### Type Properties

- [http](swift/regexcomponent/http.md)
- [httpComponents](swift/regexcomponent/httpcomponents.md)
- [iso8601Components](swift/regexcomponent/iso8601components.md)

### Type Methods

- [iso8601Components(timeZone:includingFractionalSeconds:dateSeparator:dateTimeSeparator:timeSeparator:)](swift/regexcomponent/iso8601components(timezone:includingfractionalseconds:dateseparator:datetimeseparator:timeseparator:).md)
- [iso8601ComponentsWithTimeZone(includingFractionalSeconds:dateSeparator:dateTimeSeparator:timeSeparator:timeZoneSeparator:)](swift/regexcomponent/iso8601componentswithtimezone(includingfractionalseconds:dateseparator:datetimeseparator:timeseparator:timezoneseparator:).md)
- [iso8601DateComponents(timeZone:dateSeparator:)](swift/regexcomponent/iso8601datecomponents(timezone:dateseparator:).md)

## Relationships

### Inherited By

- [CustomConsumingRegexComponent](swift/customconsumingregexcomponent.md)

### Conforming Types

- [Anchor](regexbuilder/anchor.md)
- [Capture](regexbuilder/capture.md)
- [Character](swift/character.md)
- [CharacterClass](regexbuilder/characterclass.md)
- [ChoiceOf](regexbuilder/choiceof.md)
- [Local](regexbuilder/local.md)
- [Lookahead](regexbuilder/lookahead.md)
- [NegativeLookahead](regexbuilder/negativelookahead.md)
- [One](regexbuilder/one.md)
- [OneOrMore](regexbuilder/oneormore.md)
- [Optionally](regexbuilder/optionally.md)
- [Reference](regexbuilder/reference.md)
- [Regex](swift/regex.md)
- [Repeat](regexbuilder/repeat.md)
- [String](swift/string.md)
- [Substring](swift/substring.md)
- [TryCapture](regexbuilder/trycapture.md)
- [Unicode.Scalar](swift/unicode/scalar.md)
- [ZeroOrMore](regexbuilder/zeroormore.md)

## See Also

### Regular Expressions

- [Regex](swift/regex.md)
- [RegexRepetitionBehavior](swift/regexrepetitionbehavior.md)
- [RegexSemanticLevel](swift/regexsemanticlevel.md)
- [RegexWordBoundaryKind](swift/regexwordboundarykind.md)
- [AnyRegexOutput](swift/anyregexoutput.md)
- [CustomConsumingRegexComponent](swift/customconsumingregexcomponent.md)
