Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why is the language matched by /(.)\1/ non-regular? Isn't it finite (aa, bb, cc, dd, ..., zz if your alphabet is the lowercase letters a-z)? And all finite languages are trivially regular.

Maybe he meant /(.*)\1/?

Note: I know that backreferences make Perl regexes capable of matching non-regular languages, but this doesn't seem like an example of that.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: