[DOCS] Document additional backslash for regex (#412)
* [DOCS] Document additional backslash for regex * double-backslash
This commit is contained in:
parent
d9584dca63
commit
c95c0f6aa4
1 changed files with 16 additions and 10 deletions
|
|
@ -104,7 +104,10 @@ class FromSourceVariablesRegex(StrictDictValidator):
|
|||
class RegexOptions(PluginOptions):
|
||||
r"""
|
||||
Performs regex matching on an entry's source variables. Regex can be used to filter entries
|
||||
from proceeding with download or capture groups to create new source variables.
|
||||
from proceeding with download or capture groups to create new source variables. NOTE to
|
||||
use backslashes anywhere in your regex, i.e. ``\d``, you must add another backslash escape. This
|
||||
means ``\d`` should be written as ``\\d``. This is because YAML requires an escape for any
|
||||
backslash usage.
|
||||
|
||||
Usage:
|
||||
|
||||
|
|
@ -113,34 +116,37 @@ class RegexOptions(PluginOptions):
|
|||
presets:
|
||||
my_example_preset:
|
||||
regex:
|
||||
# By default, if any match fails and has no defaults, the entry will be skipped.
|
||||
# If set to False, ytdl-sub will error and stop all downloads from proceeding.
|
||||
# By default, if any match fails and has no defaults, the entry will
|
||||
# be skipped. If False, ytdl-sub will error and stop all downloads
|
||||
# from proceeding.
|
||||
skip_if_match_fails: True
|
||||
|
||||
from:
|
||||
# For each entry's `title` value...
|
||||
title:
|
||||
# Perform this regex match on it to act as a filter.
|
||||
# This will only download videos with "Official Video" in it.
|
||||
# This will only download videos with "[Official Video]" in it. Note that we
|
||||
# double backslash to make YAML happy
|
||||
match:
|
||||
- '\[Official Video\]'
|
||||
- '\\[Official Video\\]'
|
||||
|
||||
# For each entry's `description` value...
|
||||
description:
|
||||
# Match with capture groups and defaults.
|
||||
# This tries to scrape a date from the description and produce new source variables
|
||||
# This tries to scrape a date from the description and produce new
|
||||
# source variables
|
||||
match:
|
||||
- "([0-9]{4})-([0-9]{2})-([0-9]{2})"
|
||||
|
||||
# Each capture group creates these new source variables, respectively, as well
|
||||
# a sanitized version, i.e. `captured_upload_year_sanitized`
|
||||
# Each capture group creates these new source variables, respectively,
|
||||
# as well a sanitized version, i.e. `captured_upload_year_sanitized`
|
||||
capture_group_names:
|
||||
- "captured_upload_year"
|
||||
- "captured_upload_month"
|
||||
- "captured_upload_day"
|
||||
|
||||
# And if the string does not match, use these as respective default values for the
|
||||
# new source variables.
|
||||
# And if the string does not match, use these as respective default
|
||||
# values for the new source variables.
|
||||
capture_group_defaults:
|
||||
- "{upload_year}"
|
||||
- "{upload_month}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue