Skip to content

Inserting regex into literal regex expressions #821

@stefanspringer1

Description

@stefanspringer1

(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+/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions