When you put a pattern inside brackets, the regex engine will remember the match in case you want to use it again later, so if you used the regex:


On the string:


Then \1 would refer to the letter "Z", because it is the first match you made, and \2 would be "ebra", because it's the second. (?N) differs from \N because it remembers the pattern, not the result. So ([A-Z][a-z]{4})(?1) would be a shorthand way of writing ([A-Z][a-z]{4})(?:[A-Z][a-z]{4})

Or in the case of the first example, (?1) would be [A-Z] and (?2) would be [a-z]{4}