Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    /([^])\1+/g
    1st Capturing group ([^])
    [^] match any character (Note: Avoid this construct, use . or [\s\S] instead.)
    \1 matches the same text as most recently matched by the 1st capturing group
    Quantifier: + Between one and unlimited times, as many times as possible, giving back as needed [greedy]
    g modifier: global. All matches (don't return on first match)

    To explore this further, go to https://regex101.com/r/zX7aN0/1

  • Custom User Avatar

    That solution appears to work. Only the second argument should ever be undefined (indicating that there are no minor words). What error do you get?

  • Custom User Avatar

    Don't spoil the solution to other users. Instead, mark your comment as having spoiler content.