Thursday, August 8, 2013

What's regexp `^\(.*\)\n\1$` mean?

What's regexp `^\(.*\)\n\1$` mean?

I happen to find this regular expression in sed documents:
^\(.*\)\n\1$
And it explains:
This matches a string consisting of two equal substrings separated
by a newline.
I can see that it matches any characters, ends with a newline, but nothing
more. Could someone give me an explanation?

No comments:

Post a Comment