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:
The case we ran into was:
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:
- Document clearly that Sundew extensions are included when filtering.
- Resolve the FIXME
- 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.
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:
The case we ran into was:
which worked on 3.02 when URLs were
http://something.com/2026.csvbut not once the sundew extension was added, e.g.http://something.com/2026.csv:EXTENSION:....The purpose of this issue is to:
We use regex 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$.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.