Giter Site home page Giter Site logo

Comments (3)

jenisys avatar jenisys commented on August 11, 2024

The module docstring indirectly provides examples how to use it, in the @parse.with_pattern decorator section (but it does not mention the parameter extra_types by name, it just uses the parameter in function calls).

SEE ALSO:

OTHERWISE:
Provide your own types / type-converters via extra_types.

from parse.

jenisys avatar jenisys commented on August 11, 2024

@ollie-bell
The ti type (ISO date or ISO timestamp, like: 2022-11-26 or 2022-11-26T12:04:23) comes pretty close to what you need.

from parse.

ollie-bell avatar ollie-bell commented on August 11, 2024

@jenisys thanks for pointing that out to me. Tbh I'm not really experienced with string manipulation and regex etc. so I don't understand the usage very well. I'm hoping someone can just help me out with a question :D

I have formats like

"{variable}_{domain}_{GCMsource}_{scenario}_{member}_{RCMsource}_{RCMversion}_{frequency}_{start:d}-{end:d}.nc"
"{variable}_{frequency}_{source}_{scenario}_{member}_{grid}_{start:d}-{end:d}.nc"

and strings to parse like

"pr_EUR-11_CNRM-CERFACS-CNRM-CM5_rcp45_r1i1p1_CLMcom-CCLM4-8-17_v1_day_20060101-20101231.nc"
"pr_day_MIROC-ESM-CHEM_rcp45_r1i1p1_gr1_20310101-20310101.nc"

As you can see, each {field} in the format is made up of a mix of letters, numbers and dashes (-). Underscores are always used to separate fields and never within the fields themselves.

I'd like to add a format specification within each {field} which constrains it to letters, numbers and dashes only. Curently the :w specification does letters, numbers and underscore.

Thanks!

from parse.

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.