swiftlang / swiftlang/swift-experimental-string-processing
Inserting regex into literal regex expressions
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 308
- Forks
- 52
- Avg merge
- 12h 45m
- Merged PRs (30d)
- 2
Description
(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+/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the literal regex expression entry point and compare it with the existing RegexBuilder composition shown in the issue. Define the supported interpolation syntax and add coverage for embedding greeting in a literal; done when the example compiles and matches the intended greeting forms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100