Note that, based on that definition, if the first and last characters are the same, then the answer is "the string minus the last character". Which leads to:
/^(.+?).*\1$/
Which leads to a full solution of:
/^((.*?).*?)\2*\1$/
which might be horribly inefficient (at least for some cases) or might not; I haven't considered it.
- tye
In reply to Re^3: Finding repeat sequences. (only regex)
by tye
in thread Finding repeat sequences.
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |