Regular Expressions¶
A regular expression is a sequence of characters that specifies a search pattern. PHP currently uses the PCRE library, and used to have 2 such libraries.
<?php
preg_match('/(foo)(bar)(baz)/', 'foobarbaz', $matches, PREG_OFFSET_CAPTURE);
print_r($matches);
?>
See also How to Use PHP Regular Expressions for Pattern Matching and Data Validation, Getting Started with PHP Regular Expressions