FOLLOWED BY Operator WITHIN Operator EVERY Operator

EPL Reference: Operators 3-5

3.8.2 REGEXP Operator

The REGEXP operator is a form of pattern matching based on regular expressions implemented through the Java java.util.regex package. The syntax of REGEXP is: test_expression [NOT] REGEXP pattern_expression The test_expression is any valid expression yielding a String type or a numeric result. The optional NOT keyword specifies that the result of the predicate be negated. The REGEXP keyword is followed by any valid regular expression pattern_ expression yielding a String-typed result. The result of a REGEXP expression is of type Boolean. If the value of test_ expression matches the regular expression pattern_expression, the result value is true. Otherwise, the result value is false. An example for the REGEXP operator is below. SELECT FROM PersonLocationEvent RETAIN ALL WHERE name REGEXP Jack

3.9 Temporal Operators

This section describes the following temporal operations: ■ Section 3.9.1, FOLLOWED BY Operator ■ Section 3.9.2, WITHIN Operator ■ Section 3.9.3, EVERY Operator

3.9.1 FOLLOWED BY Operator

The FOLLOWED BY operator specifies that first the left hand expression must turn true and only then is the right hand expression evaluated for matching events. For example, the following pattern looks for event A and if encountered, looks for event B: A FOLLOWED BY B This does not mean that event A must immediately be followed by event B. Other events may occur between the event A and the event B and this expression would still evaluate to true. If this is not the desired behavior, the NOT operator can be used.

3.9.2 WITHIN Operator

The WITHIN qualifier acts like a stopwatch. If the associated pattern expression does not become true within the specified time period it is evaluated by the engine as false. The WITHIN qualifier takes a time period as a parameter as specified in Section 2.4.4, Specifying Time Interval. This pattern fires if an A event arrives within 5 seconds after statement creation. A WITHIN 5 seconds This pattern fires for all A events that arrive within 5 second intervals. 3-6 Oracle Complex Event Processing EPL Language Reference

3.9.3 EVERY Operator

The EVERY operator indicates that the pattern sub-expression should restart when the sub-expression qualified by the EVERY keyword evaluates to true or false. In the absence of the EVERY operator, an implicit EVERY operator is inserted as a qualifier to the first event stream source found in the pattern not occurring within a NOT expression. The EVERY operator works like a factory for the pattern sub-expression contained within. When the pattern sub-expression within it fires and thus quits checking for events, the EVERY causes the start of a new pattern sub-expression listening for more occurrences of the same event or set of events. Every time a pattern sub-expression within an EVERY operator turns true the engine starts a new active sub-expression looking for more events or timing conditions that match the pattern sub-expression. This pattern fires when an A event is followed by a B event and continues attempting to match again after the B event: EVERY A FOLLOWED BY B This pattern also fires when an A event is followed by a B event, but continues attempting to match again after the A event: EVERY A FOLLOWED BY B The EVERY in this pattern is optional, since it would implicitly be placed here if it was absent. 4 EPL Reference: Functions 4-1 4 EPL Reference: Functions This section contains information on the following subjects: ■ Section 4.1, Single-row Functions