Created
December 25, 2013 02:18
-
-
Save DanielleSucher/8119670 to your computer and use it in GitHub Desktop.
Answers to the regex golf puzzles. These were actually pretty frustrating - inelegant solutions generally got better scores than elegant ones!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Regex Golf | |
http://regex.alf.nu/ | |
My total score: 3569 | |
Plain strings (205) - .*foo | |
Anchors (208) - k$ | |
Ranges (202) - ^[a-f]+$ | |
Backrefs (201) - (...).*\1 | |
Abba (193) - ^(?!.*(.)(.)\2\1) | |
A man, a plan (172) - ^[^p]?(.)(.).?\2\1 | |
Prime (285) - ^(?!(xx+?)\1+$) | |
Four (193) - ([aeiou])(.\1){3} | |
Order (198) - ^[^o].{4,5}$ | |
Triples (569) - ([0136]0([023469]|1[25])|24|31|47|50|58|60|7[2568]|87)$|3.*05 | |
Glob (384) - ^([bcdlrw][^ai]|p|[\*m](er|[fiptv])) | |
Balance (227) - ^$|^(<>)+$|^<{4}>(?!><{4})|^<<>(>(<|$)|<<<<>>)|^<<<(>><{1,3}>|>>><<|><|<<>>(<|>><|><>{0,2}<)) | |
Powers (92) - ^(?!(x(xx)+?)\1*$) | |
Long count (220) - ^0.+0..1..1.. (..0)+..1.1 ..0..1..1.10.. ..11.{9}1 | |
Long count v2 (220) - ^0.+0..1..1.. (..0)+..1.1 ..0..1..1.10.. ..11.{9}1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment