Hold up! I know there were questions about whether whitespace should be non-semantic or not in the various modes, but it had utterly escaped my attention that we have this inconsistency here. Even if whitespaces are semantic in multiline regex literals, one would expect the leading and trailing newlines to be ignored by analogy with string literals. Is this not proposed to be the case? If not, why not?
2 posts were merged into an existing topic: SE-0354 (Second Review): Regex Literals
Was this change upstreamed in the proposal, or is there an edited version somewhere? It still deprecates prefix /
in the proposal.
![](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/lantua/48/8868_2.png)
Was this change upstreamed in the proposal, or is there an edited version somewhere? It still deprecates prefix
/
in the proposal.
I have a PR up to amend the proposal: [SE-0354] Update regex literal proposal by hamishknight · Pull Request #1651 · apple/swift-evolution · GitHub
![](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/48.png)
Even if whitespaces are semantic in multiline regex literals, one would expect the leading and trailing newlines to be ignored by analogy with string literals. Is this not proposed to be the case? If not, why not?
Can I check if this question is addressing the proposal, or @Paul_Cantrell's thoughts?
The proposal is that with multi-line literals, whitespace is not semantic. So leading and trailing newlines are ignored, not just by analogy with string literals but because all whitespace is ignored.
![](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ben_cohen/48/296_2.png)
Can I check if this question is addressing the proposal, or @Paul_Cantrell's thoughts?
The proposal is that with multi-line literals, whitespace is not semantic. So leading and trailing newlines are ignored, not just by analogy with string literals but because all whitespace is ignored.
I was asking about the proposal; this makes sense.
I think I misunderstood @Paul_Cantrell's example, where it's the internal space between "hello" and "world" that becomes ignored in the case of a multiline literal, causing it not to match "hello world". That's...unfortunate but a different issue.
Review Update
The core team has decided to return the proposal for revision and a second review is now running.
I have moved some of the recent discussion to that review thread.