Examples below using a tree like this:

 
project
    ├── folder1
    │   └── subfolder1
    │       └── file1
    └── folder2
    ├── file1
    └── file2
  

  Both select and get-item commands typically accept a path in a tree, but perform different actions and write different results into output pipe. 'select' command, well, selects item with given path and returns a table. This allows to conveniently chain 'select' with 'get-menu':

get-tree | select "project" | get-menu "Refresh" | click

  'get-item', however, just locates an item in a tree (expanding parent items if necessary and failing if item cannot be found) and returns a reference to an item. 'get-item' commands can be chained into a single pipeline. In this case second (third, etc.) 'get-item' will search for children in given parent item. Also there's a command select-item, which selects an item given into its input pipe:

// The following pipelines are equivalent:
get-item "project" | get-item "folder1" | get-item "subfolder1" | get-item "file1" | select-item
get-item "project/folder1/subfolder1/file1" | select-item
select "project/folder1/subfolder1/file1"

  Regular expressions can be used to identify tree items with one restriction – regular expressions are only applied on each path segment, so it is impossible to skip an arbitrary number of segments with ".*". When Q7 searches for an item, it acts like this:

     
  1. Splits given path by slashes (unless they are escaped by backslash) into segment  
  2.  
  3. Starting from top-level items, locates a first match and then goes to a next segment  
  4.  
  5. If there's no match, the command fails  
// valid selections:
get-item "project/folder1/sub.*"
get-item "project/.*/sub.*"
get-item ".*/.*/.*"

// invalid selections:
get-item ".*/sub.*"
get-item ".*sub.*"

  '-all' switch can be passed to select command to indicate that all matches should be selected:

select ".*/.*/.*" -all // selects 'subfolder1', 'file1' and 'file2'
select ".*/.*/file\\d" -all // selects 'file1' and 'file2' in 'folder2'
select ".*/.*/sub.*/.*" -all // selects 'file1' in 'subfolder1'

Both 'get-item' and 'select' automatically fail if they could not locate a match. So in order to test presense of an item by regex, it is enough to put a get-item <pattern> command, no need to put assertions on a caption property.

// Command below fails with error message:
//   Failed to set selection: [[foo.*, .*, sub.*, .*]]
select "foo.*/.*/sub.*/.*"