Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
same :c
It is just 2 months since I created it. Do you have some question ?
Please use spoiler flag next time.
The regex used here: /^(.*?)\1+$/
basically means : match a string that starts with any characters (that should be repeated as few times as possible) and put that inside of a group. This group can be repeated 1 or more times until the string ends.
I assume you got confused by the '*?' the asterisk means 0 or more times and the following '?' makes this expression lazy - means match as few characters that follow the pattern as possible.
the '\1' refers to the pattern of the matched group, which can be repeated 1 or more times.
This way he matches the shortest pattern that is repeated through the entirety of the string. A pretty smart way of solving this exercise.
This comment is hidden because it contains spoiler information about the solution
Please, use spoiler flag next time.
Use https://regex101.com/ make sure ECMAScript is selected.
Hi again, read this, please: https://docs.codewars.com/getting-started/solving-kata
There is no need to post solutions in Discourse, you can discuss about your solution in Solutions after you submit your own. You can also see there other solutions and check if there are other ways to solve the kata (there almost always are).
Please don't post solutions in Discourse.