qr{(?smx) ^ # From the beginning (?: # In a group... [^.]* # Match any character except period, any number of times \. # followed by a period )? # math the group 0 or 1 times (.*) # then capture everything else }