How does this regex find triangular numbers?
Explanation Here’s a schematic breakdown of the pattern: from beginning… | …to end | | ^(\1.|^.)+$ \______/|___match group 1 one-or-more times The (…) brackets define capturing group 1, and this group is matched repeatedly with +. This subpattern is anchored with ^ and $ to see if it can match the entire string. Group 1 … Read more