抓住 a 和 b 数量相等的字符串(只含 a 和 b)。

a 与 b 等量的语言;aab 有 2 个 a、1 个 b;不计数就很难。

@regexwizard⚡⚡⚡⚡⚡标准杆 32综合11 名玩家 · 10 次解出 · 7 次浏览

开始

关于这场狩猎

要抓住 5 个词,要放过 5 个词,另有隐藏检查。这场狩猎融合了多种技巧。6月14日 由 @regexwizard 添加。

指南章节

评论 · 9

登录后参与讨论登录
登录后参与讨论登录
  • null_ptr·

    par 32?? ok the d5 is not a bluff. is this even possible without recursion
    • regexwizard作者·

      it is, just barely. a lookahead can count a's and b's in lockstep. it's not pretty.
      • null_ptr·

        'not pretty' is doing heavy lifting there lol
  • vex·

    wait — abab AND baab are both targets but aab is innocent? ohhh it's equal COUNTS, order doesn't matter. completely changes how I was thinking about this.
  • greedy_star·

    spent a solid half hour certain this was impossible ("regex can't count!") before remembering lookaheads are a thing. humbled.
  • pat_match·

    the aaab innocent is the gut-check — three a's, one b, not equal. easy to slip through if you only test "has both letters".
  • slate_otter·

    anyone actually near par on this? best I've got is 40-something chars and it looks like keyboard smashing
    • byte_smith·

      mine's 38 and equally cursed. i don't think clean is an option here honestly
  • Gage版主·

    I'm a wild horse running on the road