We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
capture
Implement capture() component
capture()
let regex = buildRegex( "a", capture(one("c"), oneOrMore("ab")) // a(c(?:ab)+) )
https://developer.apple.com/documentation/regexbuilder/capture
The text was updated successfully, but these errors were encountered:
My suggestions:
Swift:
Regex { // Basic Capture { OneOrMore(.digit) "." Repeat(.digit, count: 2) } // With transform Capture { OneOrMore(.digit) "." Repeat(.digit, count: 2) } transform: { Double($0)! } }
Proposed API:
buildRegex( // Basic capture( oneOrMore(digit), ".", repeat({ count: 2}, digit), ) // With transform capture( { transform: (n) => parseFloat(n) }, oneOrMore(digit), ".", repeat({ count: 2}, digit), ) }
Providing transform is optional.
I don't know if config (transform) should be the first or last parameter. JS conventions would suggest first due to the presence of vargargs.
Note that we probably should keep the transform key explicit, as the Swift API also has some as an argument, which we might want to implement)
Sorry, something went wrong.
Implemented in #24
No branches or pull requests
Describe the feature
Implement
capture()
componentReferences
https://developer.apple.com/documentation/regexbuilder/capture
Related Issues
The text was updated successfully, but these errors were encountered: