File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Sources/_StringProcessing Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,20 @@ extension Regex {
17
17
///
18
18
/// This is non-`nil` when used on a regex that can be represented as a
19
19
/// string. The literal pattern may be different from the literal or string
20
- /// that was used to create the regex. If this regex includes components
21
- /// that cannot be represented in a regex literal, such as a capture transform
22
- /// or a custom parser that conforms to the `CustomConsumingRegexComponent`
23
- /// protocol, this property is `nil`.
20
+ /// that was used to create the regex, though parsing the `_literalPattern`
21
+ /// always generates the same internal representation as the original regex.
22
+ ///
23
+ /// // The literal pattern for some regexes is identical to the original:
24
+ /// let regex1 = /(\d+):(\d+)/
25
+ /// // regex1._literalPattern == #"(\d+):(\d+)"#
26
+ ///
27
+ /// // The literal pattern for others is different, but equivalent:
28
+ /// let regex2 = /\p{isName=BEE}/
29
+ /// // regex2._literalPattern == #"\N{BEE}"#
30
+ ///
31
+ /// If this regex includes components that cannot be represented in a regex
32
+ /// literal, such as a capture transform or a custom parser that conforms to
33
+ /// the `CustomConsumingRegexComponent` protocol, this property is `nil`.
24
34
///
25
35
/// The value of this property may change between different releases of Swift.
26
36
public var _literalPattern : String ? {
You can’t perform that action at this time.
0 commit comments