^ # match beginning of string ( # begin first stored group 1 # match a one 1+? # then match one or more ones, minimally. ) # end storing first group \1+ # match the first group, repeated one or more times. $ # match end of string.