Pattern matching paths

Several functions take String, GlobMatch or Regex patterns as arguments.

Each type of pattern, when used with a function, produces different but memorable behaviors. These are detailed in the following table with some annotations.

In the table

t[p]gets node at path [1]gets subtree of matches [2]gets subtree of matches [2] [3]
cp(t, r::T, s)
mv(t, r::T, s)
move each match to replace(path(<match>), r => s) [3] [4]
mapmatches(f,t,p::T)applies f to t[p]apply f to every matchapply f to every match
Create a single node at p
mapsubtrees(t,p::T)For every path in tree (could be non-leaf) which matches p fully, apply f

[1] the parent of this node is still set to its original parent in t. Hence path(t[p]) will give its full path. But you can do setparent(t[p], nothing) to detach it from the original tree.
[2] the subtree always has the same root as t
[3] regex matching string-matches an path string. Partial matches are allowed. surround the regex in ^...$ to match the entire path.
[4] s here is a SubstitutionString and can be created using the s"" string macro (from Base julia).