Skip to content

clarify filtering documentation #1768

Description

@reidsunderland

https://metpx.github.io/sarracenia/Reference/sr3_options.7.html#:~:text=In%20the%20above%20snippet,higher%20in%20the%20file..

After upgrading to 3.03, which includes a fix where Sundew extensions are now included in the URL when filtering, we came across a few configs with accept statements that no longer matched the URLs with Sundew extensions because the accepts ended in $.

The documentation also has a FIXME note:

Image

The case we ran into was:

accept .*.csv$

which worked on 3.02 when URLs were http://something.com/2026.csv but not once the sundew extension was added, e.g. http://something.com/2026.csv:EXTENSION:....


The purpose of this issue is to:

  1. Document clearly that Sundew extensions are included when filtering.
  2. Resolve the FIXME
  3. Potentially improve/clean up all parts of the sr3 Options document that relate to accept, reject and filtering

We use regex match:

re.match(pattern, string, flags=0)
If zero or more characters at the beginning of string match the regular expression pattern, return a corresponding Match. Return None if the string does not match the pattern; note that this is different from a zero-length match.

This means that .* is usually required at the beginning of an accept/reject statement, but not at the end. If you want to match something specific at the end of the line, you need to terminate with $.

accept .*csv
# accepts:
# ...something.csv
# ...something.csv_even_stuff_at_the_end

accept .*csv.*
# effectively the same as above

accept .*csv$
# only accepts ...something.csv
# not something.csv.with_stuff_at_the_end

This might be obvious to regex experts, but it is worth having it clearly documented for anyone who is not an expert, and for the sake of documenting the expected behaviour.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationPrimary deliverable of this item is documentationgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions