in PHP I would like to find the longest repeated string in a string
For this string ggaaabbbbhjglkhjglkhlggaaabbgbbhjglkhjglkhl
I use regex (?=((.+)(?:.*?\2)+))
and it works finding ggaaabb
but if I introduce white spaces like this ggaa abbbbhjg lkhjglkhlggaa abbgbb hjglkhjglkhl
in the string it will fail, why ? how can I make it white space proof ?