Closed amesgen closed 2 years ago
Thanks! Yeah, that's possible.
Although, "Opt" variants of current QQ functions would not work with SubGlobal
. That's for substitutions only. Are you trying to do something like this (pseudocode):
myNonAffineTraversal = [_regexOpt SubGlobal|foo (...) baz|]
?
Yeah exactly, I stumbled upon the current traversal being affine.
OK. I meant to specify SubGlobal
is for PCRE2-native substitutions only, since it's free there.
I will open another issue about that since someone on Reddit needed that as well, and prioritize that one, since it's more of a blocker.
1.1.0 is released. Traversals in the library are now global rather than affine.
I don't want to add mkRegexQQ
right now but I may in the future if there is more of a need for it. I'll keep this ticket open for now in case it becomes an issue again for you or someone else.
Perfect, #5 fixed my use case, but I agree that this can stay open as a low-priority issue. :+1:
Closing due to inactivity.
Final thoughts: A mkRegexQQ
helper function that takes arbitrary Option
s is probably undesirable because of things like callouts[^1]. If a specific Option
is desired for TH regexes that cannot be achieved using (?...)
syntax in the pattern, let an issue be opened for it.
[^1]: Option
may in the future be refactored to distinguish between safe and unsafe options at the type level using GADTs or something, or unsafe options may be removed altogether.
Thanks for this awesome package, the TH regexes for type-safe capture groups are excellent!
I migrated from lens-regex-pcre, and noted that it is not possible to customize the
Option
s for a TH regexes (in particular,SubGlobal
), in contrast to e.g._capturesOpt
.Would something like
mkRegexQQ
ormkRegexTraversalQQ
be feasible?