Skip to content

Instantly share code, notes, and snippets.

@Matojeje
Created December 2, 2022 02:11
Show Gist options
  • Save Matojeje/6510169e7f4093ba644ddb0c33f093e8 to your computer and use it in GitHub Desktop.
Save Matojeje/6510169e7f4093ba644ddb0c33f093e8 to your computer and use it in GitHub Desktop.
the puppy regular expression
const buppy = /^(?:[pb](?:[bwluh]*)?[uae]+p*|p(?:[bwluh]*)?[uae]+([pb])\1*|([pb])(?:b?[lwuh]*)?\2[uae]+|[pb]u+)(?:[yi]+?e?|e+h?)?[sz]?$/gm
for (pup of "puppy,buppy,bupy,pupy,pup,puy,up,uppy,ppuy,pbuy,bbuy,pabbi,puppeeh,bwappy,bluppy,baby,ppuies".split(",")) console.info(pup, !!pup.match(buppy))
/* by MatoCookies :: 2nd of December 2022 */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment