In chess, a turn consists of two places connected with a minus and a character for the figure: K for king, Q for queen, R for rook, B for bishop, and N for knight (since K is already used) [Source], P for Pawn. Which regular expression matches these turns?
- Ta1-a4
- Pb3-b4
- Qc8-d8
- Ne-d1
- Ne1-f2
- Ka1-b3
- f7
- x
- KA1-b2
- Qb2-c
- Qb2c5
Own turns to test:
I used [KQRBNP][a-h][1-8]-[a-h][1-8]. At the beginning, you can find all pieces, then the locations connected by -.
Next Step