Inserting regex into literal regex expressions
stefanspringer1 opened this issue · 0 comments
stefanspringer1 commented
(From the forums topic https://forums.swift.org/t/inserting-regex-into-literal-regex-expressions/81070.)
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 }
}It should be possible to insert the greeting regex directly into a literal regex (the syntax might have to be different):
let greetingSomeone = /\(greeting)( |, )\w+/