# Pattern Matching

foo

## Match any path segment

Let’s assume we want to wait for the next event that has three path segments:

    sync "/*/*/*"

This will match any Time State event with exactly three path segments, regardless of their names. For example:

- foo
- foo
- `cue "/eggs/beans/toast"`
- `cue "/moog/synths/rule"`

However, it will not match paths with fewer or more path segments. The following will not match:

- foo
- foo
- `cue "/eggs"`

Each `*` means any content. So we could match paths with just one segment with `/*` or paths with five segments with `/*/*/*/*/*`

## Matching partial segments

foo

- foo
- foo
- foo

However, it wouldn’t match the following:

- foo
- foo
- foo

foo

## Matching Nested Path Segments

foo

- foo
- foo
- foo
- foo

## Matching Single Letters

You can use the `?` character to match against a single char such as `"/?oo/bar/baz"` which will match:

- foo
- `cue "/goo/bar/baz"`
- `cue "/too/bar/baz"`
- `cue "/woo/bar/baz"`

## Matching Multiple Words

foo

- foo
- foo
- foo

## Matching Multiple Letters

foo

- foo
- foo
- foo

foo

- foo
- foo
- foo
- foo
- foo

## Combining Matchers

When calling `sync` or `get` you are free to combine matchers in any order you see fit to powerfully match any Time State event created by `cue` or `set`. Let’s look at a crazy example:

    sample :loop_amen

## OSC Pattern Matching

For those curious, these matching rules are based on the Open Sound Control pattern matching specification which is explained in detail here: http://opensoundcontrol.org/spec-1_0