Skip to content

Commit aefec8d

Browse files
authored
Merge pull request #59079 from stephentyrone/regex-release-note
Add cursory release note for Regex.
2 parents e660493 + 1bbf180 commit aefec8d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,31 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
55

66
## Swift 5.7
77

8+
* [SE-0350][]:
9+
10+
The standard library has a new `Regex<Output>` type.
11+
12+
This type represents an _extended regular expression_, allowing more fluent
13+
string processing operations. A `Regex` may be created by
14+
[initialization from a string][SE-0355]:
15+
```
16+
let pattern = "a[bc]+" // matches "a" followed by one or more instances
17+
// of either "b" or "c"
18+
let regex = try! Regex(pattern)
19+
```
20+
Or via a [regex literal][SE-0354]:
21+
```
22+
let regex = #/a[bc]+/#
23+
```
24+
In Swift 6, `/` will also be supported as a delimiter for `Regex` literals.
25+
You can enable this mode in Swift 5.7 with the `-enable-bare-slash-regex`
26+
flag. Doing so will cause some existing expressions that use `/` as an
27+
operator to no longer compile; you can add parentheses or line breaks as a
28+
workaround.
29+
30+
There are [new string-processing algorithms][SE-0357] that support
31+
`String`, `Regex` and arbitrary `Collection` types.
32+
833
* [SE-0329][]:
934
New types representing time and clocks were introduced. This includes a protocol `Clock` defining clocks which allow for defining a concept of now and a way to wake up after a given instant. Additionally a new protocol `InstantProtocol` for defining instants in time was added. Furthermore a new protocol `DurationProtocol` was added to define an elapsed duration between two given `InstantProtocol` types. Most commonly the `Clock` types for general use are the `SuspendingClock` and `ContinuousClock` which represent the most fundamental clocks for the system. The `SuspendingClock` type does not progress while the machine is suspended whereas the `ContinuousClock` progresses no matter the state of the machine.
1035

@@ -9403,8 +9428,12 @@ Swift 1.0
94039428
[SE-0346]: <https://github.com/apple/swift-evolution/blob/main/proposals/0346-light-weight-same-type-syntax.md>
94049429
[SE-0347]: <https://github.com/apple/swift-evolution/blob/main/proposals/0347-type-inference-from-default-exprs.md>
94059430
[SE-0349]: <https://github.com/apple/swift-evolution/blob/main/proposals/0349-unaligned-loads-and-stores.md>
9431+
[SE-0350]: <https://github.com/apple/swift-evolution/blob/main/proposals/0350-regex-type-overview.md>
94069432
[SE-0352]: <https://github.com/apple/swift-evolution/blob/main/proposals/0352-implicit-open-existentials.md>
94079433
[SE-0353]: <https://github.com/apple/swift-evolution/blob/main/proposals/0353-constrained-existential-types.md>
9434+
[SE-0354]: <https://github.com/apple/swift-evolution/blob/main/proposals/0354-regex-literals.md>
9435+
[SE-0355]: <https://github.com/apple/swift-evolution/blob/main/proposals/0355-regex-syntax-run-time-construction.md>
9436+
[SE-0357]: <https://github.com/apple/swift-evolution/blob/main/proposals/0357-regex-string-processing-algorithms.md>
94089437
[SE-0358]: <https://github.com/apple/swift-evolution/blob/main/proposals/0358-primary-associated-types-in-stdlib.md>
94099438

94109439
[SR-75]: <https://bugs.swift.org/browse/SR-75>

0 commit comments

Comments
 (0)