in reply to tic-tac-toe regex golf

Original post: 49 keystrokes:

^(...)*(X|O)\2\2|(X|O)(.{2,3}\3)\4|^..(X|O).\5.\5

47 keystrokes:

^(...)*(X|O)\2\2|(X|O)(...?\3)\4|^..(X|O).\5.\5

If you can safely assume that "X" and "O" are the only "word" characters (alpha characters) found in the solution, you could save a few keystrokes like this (44 keystrokes):

^(...)*(\w)\2\2|(\w)(...?\3)\4|^..(\w).\5.\5

Note: In my solutions I made no attempt to verify the suitability of your original regex. I simply modified your regex in ways that preserved identical functionality in fewer keystrokes.


Dave


"If I had my life to live over again, I'd be a plumber." -- Albert Einstein