Skip to main content
fix
Source Link
J B
  • 10k
  • 27
  • 60

Perl regex, 2424 69

^(.(.+)(?=\2{$a=$+})(.$|(??{"\Q$a"})(?{$a=substr$a,1}))*(?(?{''eq$a})$|(*F))

Obviously not a genuine CS regular expression, but those modern recursive regexes can work wondersbut those modern recursive regexes can work wonders and the edited (but fixed) version is not that short at all. I'm starting to wonder if actual Perl code, with the ability to reverse the starting string, wouldn't be shorter than that.

Perl regex, 24

^(.(.+)(?=\2)(.$|(?1)))

Obviously not a genuine CS regular expression, but those modern recursive regexes can work wonders.

Perl regex, 24 69

^.(.+)(?{$a=$+})((??{"\Q$a"})(?{$a=substr$a,1}))*(?(?{''eq$a})$|(*F))

Obviously not a genuine CS regular expression, but those modern recursive regexes can work wonders and the edited (but fixed) version is not that short at all. I'm starting to wonder if actual Perl code, with the ability to reverse the starting string, wouldn't be shorter than that.

Source Link
J B
  • 10k
  • 27
  • 60

Perl regex, 24

^(.(.+)(?=\2)(.$|(?1)))

Obviously not a genuine CS regular expression, but those modern recursive regexes can work wonders.