Comments (5)
thanks @alexobviously i'll try to test it today and let you know
from bishop.
it works 🙌 thanks @alexobviously for releasing this so quickly
from bishop.
Hey, so I just merged this and upon testing a bit more realised there's still a problem. Lichess PGNs with clock annotations look like this:
1. e4 { [%clk 0:02:00] } 1... c6 { [%clk 0:02:00] } 2. Nc3 { [%clk 0:02:00] } 2... d5 { [%clk 0:02:01] } 3. d4 { [%clk 0:02:00] } 3... dxe4 { [%clk 0:02:01] } 4. Nxe4 { [%clk 0:02:01] } 4... Nf6 { [%clk 0:01:59] } 5. Nxf6+ { [%clk 0:02:00] } 5... exf6 { [%clk 0:02:00] } { B15 Caro-Kann Defense: Tartakower Variation } 6. Nf3 { [%clk 0:02:00] } 6... Be6 { [%clk 0:01:57] } 7. Bd3 { [%clk 0:01:57] } 7... Bd6 { [%clk 0:01:56] } 8. h3 { [%clk 0:01:56] } 8... Qc7 { [%clk 0:01:55] } 9. O-O { [%clk 0:01:55] } 9... c5 { [%clk 0:01:54] } 10. dxc5 { [%clk 0:01:54] } 10... Bxc5 { [%clk 0:01:53] } 11. Re1 { [%clk 0:01:48] } 11... O-O { [%clk 0:01:47] } 12. a3 { [%clk 0:01:39] } 12... Qb6 { [%clk 0:01:45] } 13. Be3 { [%clk 0:01:35] } 13... Bxe3 { [%clk 0:01:42] } 14. Rxe3 { [%clk 0:01:35] } 14... Qxb2 { [%clk 0:01:41] } 15. Nd4 { [%clk 0:01:27] } 15... Re8 { [%clk 0:01:25] } 16. a4 { [%clk 0:01:13] } 16... Bd5 { [%clk 0:01:16] } 17. Rb1 { [%clk 0:01:07] } 17... Rxe3 { [%clk 0:00:41] } 18. Rxb2 { [%clk 0:01:04] } 18... Re8 { [%clk 0:00:39] } 19. Qh5 { [%clk 0:00:57] } 19... g6 { [%clk 0:00:37] } 20. Qxd5 { [%clk 0:00:56] } { Black resigns. } 1-0
There's a space between the {
and [
which unfortunately breaks your nice regex.
Can you think of an elegant regex fix for this? I was thinking about something like ((?<!(\{\s*))\[(.+)\])+
but apparently that doesn't work because lookbehinds have to be a fixed length.
Alternatively I could just find the index of the first {
and not allow matching after that, but that break if there was a meta tag with {
in it.
from bishop.
Okay, this works actually: (\[(.+)\s"(.+)"\])+
, and seems more robust too. This can only break if a move comment contains a square bracket interior that looks exactly like a header (i.e. {[Something "Something"]}), and I think that would never happen?
from bishop.
This is now live in version 1.2.6
, let me know if this meets all your requirements and I'll close this issue if so!
from bishop.
Related Issues (20)
- Forced capture rule HOT 1
- Getting the list of captured pieces for black and for white HOT 5
- Games with points win conditions sometimes drawn by stalemate HOT 1
- Add Images to README HOT 2
- Beirut Chess
- Union regions HOT 1
- Exclude certain piece types from being added to hand on capture HOT 1
- Capture by surrounding a piece (custodian/enclosure) HOT 1
- Shogi HOT 2
- Override == and hashCode for GameResults
- Promotion option: only allow promoting to a piece in hand
- Castling should be allowed in Kinglet chess
- Extinction Chess
- NotRegion HOT 1
- Wrong materialConditions for Seirawan HOT 2
- Bug for castling in chess960 HOT 2
- ParsePgn cannot handle alternative move lines in Lichess Pgn files
- Unable to generate moves in some FEN HOT 8
- parsePgn cannot handle moves of type 1.d4 without space between move number and move
- Error resulting in illegal fen castling rights in 1.4.1 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bishop.