my $rx = qr/ ^ # At the beginning of the string ( # Capture in $1 (?: # Paren for grouping (don't capture in $2) \w # match a "wordy" character (?: # paren for grouping, \s+|\z # match at least one space or the end of the string ) )* # zero or more times ) # end of capture $1 (.*) # and match what comes after storing it in $2 /x # allow these comments ;