diff --git a/docs/LOOT Metadata Syntax.html b/docs/LOOT Metadata Syntax.html index f2a3ab3f..9e72851c 100644 --- a/docs/LOOT Metadata Syntax.html +++ b/docs/LOOT Metadata Syntax.html @@ -423,7 +423,7 @@ nav: 0 -
Key NameData TypeRequiredNotes
namestringCan be an exact plugin filename or a regular expression plugin filename. If the period that precedes the file extension has been escaped (eg. \.esp, \.esm), the string is treated as a regular expression, otherwise it is treated as an exact filename. +
namestringCan be an exact plugin filename or a regular expression plugin filename. If the filename contains any of the characters :\*?|, the string will be treated as a regular expression, otherwise it will be treated as an exact filename. For example, Example\.esm will be treated as a regular expression, as it contains a \ character.
enabledbooleanEnables or disables use of the plugin object. Used for user rules, but no reason to use it in the masterlist. If unspecified, defaults to true.
priorityintegerModifies plugin position relative to others that change one or more of the same records, but which are otherwise unrelated (ie. neither plugin lists the other as a master, requirement, or in its after list). Plugins that don't change any of the same records are not compared, unless:
    @@ -590,11 +590,12 @@ msg: -
    Feature Supported?v0.5v0.6v0.7 +
    Feature Supported?v0.5v0.6v0.7v0.8
    GitHub Flavored Markdown message formattingOnly URL hyperlinking is supported, for file:, http: and https: URLs, using the [label](url) and <url> syntaxes.LOOT uses the Marked library (v0.3) to provide support for most of GitHub Flavored Markdown, minus the GitHub-specific features (like @mentions, issue/repo linking and emoji).
    Message string substitution (ie. sub:)NoYes
    YAML merge keys (ie. <<:)NoYes +
    Regex plugin entriesMust end with \.esp or \.esm.Must contain any of :\*?|

    License

    diff --git a/src/backend/metadata/plugin_metadata.cpp b/src/backend/metadata/plugin_metadata.cpp index dce08b9b..a45b3561 100644 --- a/src/backend/metadata/plugin_metadata.cpp +++ b/src/backend/metadata/plugin_metadata.cpp @@ -355,7 +355,10 @@ namespace loot { } bool PluginMetadata::IsRegexPlugin() const { - return boost::iends_with(name, "\\.esm") || boost::iends_with(name, "\\.esp"); + // Treat as regex if the plugin filename contains any of ":\*?|" as + // they are not valid Windows filename characters, but have meaning + // in regexes. + return strpbrk(name.c_str(), ":\\*?|") != nullptr; } bool PluginMetadata::IsPriorityExplicit() const { diff --git a/src/tests/backend/metadata/test_plugin_metadata.h b/src/tests/backend/metadata/test_plugin_metadata.h index a3f4b627..dcb2daaa 100644 --- a/src/tests/backend/metadata/test_plugin_metadata.h +++ b/src/tests/backend/metadata/test_plugin_metadata.h @@ -601,19 +601,19 @@ TEST_F(PluginMetadata, IsRegexPlugin) { EXPECT_FALSE(pm.IsRegexPlugin()); pm = loot::PluginMetadata("Blank[[:blank:]]- Different.esm"); - EXPECT_FALSE(pm.IsRegexPlugin()); + EXPECT_TRUE(pm.IsRegexPlugin()); pm = loot::PluginMetadata("Blank\\.esm"); EXPECT_TRUE(pm.IsRegexPlugin()); pm = loot::PluginMetadata("Blank - (Different )*Master Dependent.esm"); - EXPECT_FALSE(pm.IsRegexPlugin()); + EXPECT_TRUE(pm.IsRegexPlugin()); pm = loot::PluginMetadata("Blank - (Different )?Master Dependent.esm"); - EXPECT_FALSE(pm.IsRegexPlugin()); + EXPECT_TRUE(pm.IsRegexPlugin()); pm = loot::PluginMetadata("Blank.es(p|m)"); - EXPECT_FALSE(pm.IsRegexPlugin()); + EXPECT_TRUE(pm.IsRegexPlugin()); } TEST_F(PluginMetadata, YamlEmitter) {