Implement onmatch in the Observer API

Closes #2648
Closes #2017
Merge pull request #3027 from callahad/issue_2648_onmatch

Implement onmatch in the Observer API