I want to filter a PGN database for games where one side plays a series of moves but I don't care what the other side does during that sequence. For example the bongcloud is where one side plays 1. e3 ... 2. Ke2. (I know there are lots of variations but that's ignore that for now). I don't really care what black does on turn one or two. How would I filter for that? I don't want to list out all the moves black can make and then input 20+ parameters. Is there a simpler way to achieve this?

1 Answer 1


I found an answer. After spending a few hours digging through PGN-Extract's website I found this:

* b6

means that you are interested in all games in which Black replied 1 ... b6 regardless of White's first move. The sequence:

d4 * c4 * Nc3 *

will pick up Nimzo-Indian, Grunfeld, King's Indian, etc. defenses. This notation is not possible with positional variations

Edit: You put the above text in a file and then set it as a parameter when calling pgn-extract like this:

pgn-extract -v[file that contains the rules]

  • 1
    Sorry it took you several hours to find it in the documentation I wrote for pgn-extract! The documentation has tended to grow slightly chaotically over the years as each new feature was added but I would be happy to receive suggestions for how it could be improved.
    – kentdjb
    Commented Dec 27, 2021 at 7:42
  • 1
    For reference, you can find pgn-extract at [Inline Link] (cs.kent.ac.uk/~djb/pgn-extract) It's free and open source.
    – kentdjb
    Commented Dec 27, 2021 at 15:14
  • @kentdjb I would suggest rewording the index/table of contents to be more concise and intuitive. For example, the two entries in this image can be combined and shortened into "Matching by FEN" And another four entries could be shortened into "Matching by Game Result". This makes finding what you need from the index much easier and less daunting because you're not just looking at a giant wall of text. Commented Dec 27, 2021 at 20:52
  • 1
    Simon: thanks for those suggestions. I will aim to do some revision. I have also been thinking that it would be good to have a section of typical use cases for ease of reference.
    – kentdjb
    Commented Dec 27, 2021 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.