GithubHelp home page GithubHelp logo

Comments (5)

deathcoder avatar deathcoder commented on June 15, 2024 1

thanks @alexobviously i'll try to test it today and let you know

from bishop.

deathcoder avatar deathcoder commented on June 15, 2024 1

it works 🙌 thanks @alexobviously for releasing this so quickly

from bishop.

alexobviously avatar alexobviously commented on June 15, 2024

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.

alexobviously avatar alexobviously commented on June 15, 2024

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.

alexobviously avatar alexobviously commented on June 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.