.. index:: regular expressions,

.. _#ug-regular_expressions:

6. Regular Expressions
=======================

Regular expression matching provides precision, power, and flexibility
for matching patterns. AMPS supports regular expression matching on
topics and within content filters. Regular expressions are implemented
in AMPS using the Perl-Compatible Regular Expressions (PCRE) library.
For a complete definition of the supported regular expression syntax,
please refer to:

http://perldoc.perl.org/perlre.html

To use regular expressions for topic matching, provide a regular
expression pattern where you would normally provide a topic name.

To use regular expressions in content filtering, compare strings to
regular expressions using the ``LIKE`` operator. The syntax of the
``LIKE`` operator is:

.. code::

    string LIKE pattern

where a string is any expression that provides a string, and pattern is
a literal regular expression pattern.

This chapter presents a brief overview of regular expressions in AMPS.
However, this chapter is not exhaustive. For more information on regular
expression matching, see the PCRE site mentioned above.

.. include:: ./regex-examples.inc