in reply to Regex creation

Your example paths both put "groups" under a directory that starts with "tool_". If this pattern is actually present in your data, and we can assume POSIX, a single regex can extract all of them: m[/tool_[^/]*/([^/]+)/([^/]+)/] will put the "group" in $1 and the "version" in $2.