Code Monkey home page Code Monkey logo

Comments (2)

tfeldmann avatar tfeldmann commented on June 11, 2024

Hi, yes it‘s in development. I‘m on vacation in the moment, I‘ll look into this next week ☀️

from simplematch.

mikaelho avatar mikaelho commented on June 11, 2024

Enjoy your vacation! ☀️🏝

For when you are back:

I must admit that in your absence I have experimented uncontrollably, and have now implemented some things, some of which can be turned into PRs depending on where you see this package going:

  1. + (any one character), ? (maybe one character) and | (either, can be characters or groups). These can be escaped like this {+} to match the literal "+" character. With this, you can express e.g. "1-3 characters" with +??. More power could be added by combining these with groups, but have not tried that yet.
  2. Unnamed groups can be typed: {:int}
  3. Always return a tweaked dict that has the unnamed groups stored as a list in an attribute called unnamed instead of in the dict. This makes them easier to iterate over. The tweaked dict also defines itself as True or False based on whether there were matches, not based on if any groups were found, and there is no need to check for None because the object (as a dict) and the unnamed list are always there, even if potentially empty.
  4. As an alternative to match, added a search method that returns a list of match dicts instead of the single dict.
  5. As a final insult, I experimented with using [] instead of {}, because brackets are easier to write on a Nordic keyboard, look less cryptic in the pattern, and because they make it much easier to combine patterns with f-strings.

from simplematch.

Related Issues (3)

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.