Function NormalizeRegexPattern#

Function Documentation#

inline std::string NormalizeRegexPattern(const std::string &rssPattern)#

Normalizes a regex path pattern string.

This function processes a path string to resolve current (‘.’) and parent (‘..’) directory indicators according to standard path canonicalization rules, plus custom rules for regex generation.

Rules applied:

  1. Path segments of ‘.’ are removed (e.g., “a/./b” -> “a/b”).

  2. A directory followed by ‘..’ is resolved (e.g., “a/b/../c” -> “a/c”). Special case if the parent is any directory “.*../” and “.*\/../”. Both will result in any directory “.*\/”.

  3. If a path attempts to navigate above the root (e.g., “../a” or “a/../../b”), this only works if the following directory is any directory (starts with “.*”).

Parameters:

rssPattern[in] Reference to the regex pattern string to normalize.

Returns:

The normalized regex pattern string.