I would like to parse move notation of chess extended PGN syntax with PHP:
----Begin file-------------------------------
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "test1"]
[Black "test2"]
[Result "1/2-1/2"]
[ECO "B20"]
[EventDate "2002.02.13"]
[PlyCount "6"]
[SourceDate "2002.02.13"]
- e2e4 c7c5 2. e4e5 d7d5 3. e5d6ep e7d6 1/2-1/2
[WhiteElo "2480"]
[BlackElo "2557"]
[ECO "B52"]
[EventDate "2001.06.05"]
[PlyCount "67"]
[Source "Mark Crowther"]
[SourceDate "2001.06.11"]
- e2e4 c7c5! 2. Ng1f3 d7d6!? 3. Bf1b5+ Bc8d7 4. Bb5d7+ Nb8d7?! 5. e1g1 Ng8f6 6.
Qd1e2 e7e6 7. d2d3 Bf8e7 8. Nf3g5 h7h6 9. Ng5h3 Nd7e5 10. f2f4 Ne5c6 11.
c2c4 Nf6d7 12. Nb1c3 Nc6d4 13. Qe2d1 Be7f6 14. Bc1e3 g7g6 15. Kg1h1 Bf6g7
- Be3d4 c5d4 17. Nc3b5 Qd8b6 18. a2a4 a7a6 19. a4a5 Qb6c6 20. Nb5a3 e8g8
- f4f5 g6g5 22. Nh3f2 e6f5 23. e4f5 Nd7f6 24. Na3c2 Rf8e8 25. Nf2g4 Qc6c5
- b2b4 Qc5a7 27. Ra1b1 b7b5 28. a5b6ep Qa7b6 29. Ng4f6+ Bg7f6 30. Qd1f3
Ra8a7 31. Rf1e1 Ra7e7 32. Re1e7 Re8e7 33. Rb1a1 Kg8g7 34. Kh1g1 1/2-1/2
-------end file-----------------------
This should be parsable with regex. What would be the regex syntax in this
case to get:
-move #
-source
-dest
-NAGS (!, !?, +, ep etc.)