Wednesday 8 January 2020

The joy of regular expressions

There is a claim that you are not a real programmer unless you can build regular expressions. Occasionally I have need for them in a professional capacity, but doing them on the fly is always a difficult task for me.
My most recent problem was that the pgn files from the 2020 Australian Championship had the clock times included as comments. Normally this isn't a problem as you can strip comments using chessbase, but as I don't have that on my laptop, it required a different solution (that wasn't manual deletion).  \{[\s\S]*?}\s was the magic incantation used in Brackets, which was sufficient to get the file into something I could use more easily. And as proof, here is a nice win by Jack Puccini from yesterdays round.

Puccini, Jack - O`Chee, Kevin
2020 Australian Championship , 2020.01.07


No comments: