magic-regexp icon indicating copy to clipboard operation
magic-regexp copied to clipboard

feat: default to non-capturing, opt-in with chaining `.group`

Open didavid61202 opened this issue 3 years ago • 2 comments

In preparation for #24, update all creation and chaining helper inputs with anonymous capturing group syntax to non-capturing group by default.

updated inputs:

  • creation inputs: anyOf, maybe, oneOrMore
  • chaining inputs: or, times(.between/atLeast/any), optionally

Add sub-function anyOf.group, or.group and chaining helper .group to opt-in/capture anonymous group.

Usage

// opt-in with `anyOf.group`
const defulatToNonCapture = anyOf('foo', exactly('bar')) // Input<"(?:foo|bar)", never>
const capture = anyOf.group('foo', exactly('bar'), oneOrMore('baz')) // Input<"(foo|bar)", never>

// chaining with `.group`
const group = exactly('foo').times.between(2,5).group() // Input<"((?:foo){2,5})", never>
  • [x] add/update tests
  • [x] update docs
  • [ ] finalize naming
  • [ ] resolve: chaining .group after or.group result double wrapping with ( )

didavid61202 avatar Aug 03 '22 03:08 didavid61202

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
magic-regexp ✅ Ready (Inspect) Visit Preview Aug 17, 2022 at 3:28PM (UTC)

vercel[bot] avatar Aug 03 '22 03:08 vercel[bot]

Codecov Report

Merging #42 (54e5351) into main (d935e87) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main       #42   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          375       394   +19     
  Branches        83        82    -1     
=========================================
+ Hits           375       394   +19     
Impacted Files Coverage Δ
src/core/inputs.ts 100.00% <100.00%> (ø)
src/core/internal.ts 100.00% <100.00%> (ø)
src/core/wrap.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Aug 03 '22 03:08 codecov-commenter

This pull request introduces 1 alert when merging f2941c6fd0342d5c71259d6e4ebd79ba2d9f2989 into d935e87575c8866fae05321e388ccd4a3dd16431 - view on LGTM.com

new alerts:

  • 1 for Polynomial regular expression used on uncontrolled data

lgtm-com[bot] avatar Aug 12 '22 04:08 lgtm-com[bot]

This pull request introduces 1 alert when merging 55c3bb1d6344157cdde9a7e09579c43f419dca28 into d935e87575c8866fae05321e388ccd4a3dd16431 - view on LGTM.com

new alerts:

  • 1 for Polynomial regular expression used on uncontrolled data

lgtm-com[bot] avatar Aug 12 '22 04:08 lgtm-com[bot]

This pull request introduces 1 alert when merging f39079c02369854112d6fe383c1e8826e1ef30b0 into d935e87575c8866fae05321e388ccd4a3dd16431 - view on LGTM.com

new alerts:

  • 1 for Polynomial regular expression used on uncontrolled data

lgtm-com[bot] avatar Aug 12 '22 05:08 lgtm-com[bot]

This pull request introduces 1 alert when merging 501bf41291375d0b90fee888d6fceaa6a438e398 into d935e87575c8866fae05321e388ccd4a3dd16431 - view on LGTM.com

new alerts:

  • 1 for Polynomial regular expression used on uncontrolled data

lgtm-com[bot] avatar Aug 12 '22 05:08 lgtm-com[bot]

This pull request introduces 1 alert when merging a30f31a731f3226984520dc737667678190dce4c into d935e87575c8866fae05321e388ccd4a3dd16431 - view on LGTM.com

new alerts:

  • 1 for Polynomial regular expression used on uncontrolled data

lgtm-com[bot] avatar Aug 12 '22 06:08 lgtm-com[bot]