Given a string of arbitrary (long) length that is known to comprise of a number of repetitions of an unknown length substring, (thought the last repetition my be incomplete), how to find that repeat sequence?
Eg. Given 'abcdabcdabcdabcdab' find 'abcd'.
Complications:
Eg. In 'abcdabcdabceabcdabcdabceab'; 'abcd' is a false rep; the required rep is 'abcdabcdabce';
The number of characters 'ignored' at the end of the string should be less than the length of the rep. Is is possible to code that into a regex? I guess it could just be checked afterwards.
I'm assuming that a regex solution would be possible, but I cannot wrap my brain around it today?
In reply to Finding repeat sequences. by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |