I could not find this in another topic.... When a regex has been declared e.g. via a literal expression:
let greeting = /(hello|hi)/
Then it can be nice to use this in another regex (this does work today):
let greetingSomeone = Regex {
greeting
ChoiceOf{ " "; ", " }
OneOrMore { .word }
}
Why not make it possible to insert the greeting
regex directly into a literal regex (the syntax might have to be different):
let greetingSomeone = /\(greeting)( |, )\w+/
What do you think?
Update: Added ticket Inserting regex into literal regex expressions · Issue #821 · swiftlang/swift-experimental-string-processing · GitHub.