# \[Pitch #2\] Regex Literals

**URL:** <https://forums.swift.org/t/pitch-2-regex-literals/56736>\
**Category:** Pitches\
**Created:** [April 13, 2022, 5:56pm UTC](https://forums.swift.org/t/pitch-2-regex-literals/56736 "2022-04-13T17:56:28Z")\
**Posts on this page:** 1\
**Showing post:** 35

<div class="post-metadata">

**Author:** ![johnno1962](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/johnno1962/32/6805_2.png) [@johnno1962](https://forums.swift.org/u/johnno1962)\
**Post date:** [April 15, 2022, 3:48pm UTC](https://forums.swift.org/t/pitch-2-regex-literals/56736/35 "2022-04-15T15:48:40Z")

</div>

I feel strongly we need to let go of the idea that we will be able to support the bare `/regex/` syntax. While it is certainly a well known precedent for the spelling of a regex literal, it was always a bad precedent and I don't recommend Swift pursues the sort of lexical cartwheels and recourse to heuristics blurring the line between lexical and Semantic analysis these languages have to resort to. Regex literals are a very rich and arbitrary combination characters and a single character delimiter is always going to be too flimsy for cases that come up sufficiently frequently to make the extended `#/regex/#` syntax necessary anyway.

All this aside the solution proposed for some of these problems, that of deprecating using `/` as a prefix operator is going to source break a innovative and significant open source project [The Composable Architecture](https://github.com/pointfreeco/swift-composable-architecture) and a good deal of client source that uses it. In the end, they got there first and clinging to having the bare '/regex/' syntax available simply can't be justified for a much more niche requirement such as regex literals, particularly in the face of the almost as recognisable syntax `#/regex/#` being proposed anyway which would avoid all this disruption.

I'm sure however if a way could be found to include `\` in the characters that can be used to define operators the TCA folk would be only too happy.

---

_[View the full topic](https://forums.swift.org/t/pitch-2-regex-literals/56736)._
