Regular Expressions

A regular expression, or regex, 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);

?>

Documentation

See also https://medium.com/@olivia.j.01101001/how-to-use-php-regular-expressions-for-pattern-matching-and-data-validation-d58dacb06ea1, https://www.jotform.com/blog/php-regular-expressions/

Related : Question Mark ?, Regexploit, Star *, Wildcard