^start of line
\w+any word character, repeated at least once
\s*any whitespace character, repeated any number of times
.any character (except for line terminators)
\s*any whitespace character, repeated any number of times
\w+any word character, repeated at least once
\s*any whitespace character, repeated any number of times
\1the text saved by group 1
\s*any whitespace character, repeated any number of times
\w+any word character, repeated at least once
Non-Capturing Group(?:(?!\1).)* *repeats the group contents below any number of times:
\1the text saved by group 1
.any character (except for line terminators)
$end of line
g modifier: global. Finds all matches instead of stopping after the first
m modifier: multiline. Causes ^ and $ to match the start and end of each line, not only the start and end of the string