A pattern is a mechanism for matching input. A combination of markers, operators, and characters describes a pattern. This combination includes the data to match and the operators that control how and when the data matches. More complicated patterns are made from simpler patterns.
ASL compares patterns to an input of markers and characters. As each component of a pattern matches with data, the next pattern component is compared with the next segment of input. If all of the components of a pattern match, the pattern is considered a match. If any component of a pattern fails to match its corresponding data component, the pattern is not considered a match.
A pattern that does not match fails. In most cases, when a pattern fails, the rest of the rule following that pattern does not execute.
As ASL matches patterns with data, the starting point for the next match moves to the position after the data that was matched. When a pattern fails, the starting position does not advance and may or may not go back to its original position, depending on how the rule containing the pattern is defined.
Progression of a pattern being compared to data shows that for the first match, the pattern is compared, starting with the left-most position in the data. The pattern matches.
As the result of the successful match, the starting point for the next comparison, the second match, is immediately after the last successful data match. The pattern matches.
For the third match, the starting position is in a different location again because of the previous successful match. This comparison fails and the start position resets. Depending on the pattern, the start position resets to either the starting point for this comparison or to the beginning of the data.