Giter Site home page Giter Site logo

Comments (7)

xesscorp avatar xesscorp commented on May 31, 2024 1

Even a blind squirrel finds a nut once and a while!

from skidl.

xesscorp avatar xesscorp commented on May 31, 2024

I'm confused by this. I want to match the literal ( character at the start of the string, not start a group. All the man pages for the re module (from 2.7 up to 3.8) state that I can use \( or [(] to do that. So why is this flagged as deprecated? Is this a spurious error message, or am I overlooking something?

from skidl.

johnthagen avatar johnthagen commented on May 31, 2024

@xesscorp I think the correct way to create regular expression strings to avoid any of these issues is to use a raw string: r"(\s*pad\s+([^\s)]+)", that avoids the issue of having to distinguish between escaping in the string (which at least in Python 3 can mean unicode escapes) and using \ in the regular expression string.

See https://stackoverflow.com/a/50504635/1398841

from skidl.

xesscorp avatar xesscorp commented on May 31, 2024

OK, I see now. I made the change to a raw string and checked it in. Thanks!

from skidl.

johnthagen avatar johnthagen commented on May 31, 2024

@xesscorp I think this was fixed in error: 27cb168

I believe you want to remove the \ before the first ( since a raw string will keep the \ now.

r"\(\s*pad\s+([^\s)]+)
r"(\s*pad\s+([^\s)]+)

from skidl.

xesscorp avatar xesscorp commented on May 31, 2024

The regex is trying to detect a starting paren of a pad definition. If I removed the \, then the paren would be looked at as the start of a group. That's not what I want. There would also be unbalanced grouping parens: two ( and only one ).

from skidl.

johnthagen avatar johnthagen commented on May 31, 2024

@xesscorp Ah, I see what you're saying. You're right, you did it correctly. 👍

from skidl.

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.