Skip to content

Commit

Permalink
add regex and peg for standard names
Browse files Browse the repository at this point in the history
  • Loading branch information
mcflugen committed Mar 3, 2024
1 parent 1522a2b commit 6de8163
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,55 @@
[![PyPI](https://img.shields.io/pypi/v/standard_names)](https://pypi.org/project/standard_names)


standard_names
==============
# standard_names

Python utilities for working with CSDMS Standard Names.

CSDMS Standard Names is an element of the [CSDMS Workbench](https://csdms.colorado.edu/wiki/Workbench),
an integrated system of software tools, technologies, and standards
for building and coupling models.

## As Regular Expression

Links
-----
```
^ # Start of the object name
[a-z]+ # Starts with one or more lowercase letters
(?: # Start of a non-capturing group for subsequent parts
[-~_]? # Optional separator: hyphen, tilde, or underscore
[a-zA-Z0-9]+ # One or more alphanumeric characters
)* # Zero or more repetitions of the group
__ # Double underscore separator
[a-z]+ # Start of the quantity
(?: # Start of a non-capturing group for subsequent parts
[-~_]? # Optional separator: hyphen, tilde, or underscore
[a-zA-Z0-9]+ # One or more alphanumeric characters
)* # Zero or more repetitions of the group
$ # End of the name
```

## As Parsing Expression Grammar

```peg
Start
= LowercaseWord UnderscoreSeparator LowercaseWord
LowercaseWord
= [a-z] AdditionalCharacters*
AdditionalCharacters
= Separator? Alphanumeric+
Separator
= "-" / "~" / "_"
Alphanumeric
= [a-zA-Z0-9]
UnderscoreSeparator
= "__"
```

# Links

* [Source code](http://github.com/csdms/standard_names): The
*standard_names* source code repository.
Expand Down

0 comments on commit 6de8163

Please sign in to comment.