Support regular expressions based on PCRE library. The module must be loaded with dl('regex');
Functions are compatible with theire PHP pendants.
|preg_match (string pattern, string subject, [, array& matches, number flags=0])||number||Find the first regular expression pattern in subject. If matches is given as reference to an array, it will be filled with the matches. If flags is 1 (PREG_OFFSET_CAPTURE) then the position of found pattern is stored in matches. Numbers of found patterns are returned. On error false is returned. See also preg_match () for detailed description.|
|preg_match_all (string pattern, string subject, [, array& matches, number flags=0])||number||Same as preg_match but find all regular expression patterns. flags can have following binary combined values: 1 = PREG_OFFSET_CAPTURE, 2 = PREG_SET_ORDER. See also preg_match_all () for detailed description.|
|preg_replace (mixed pattern, mixed replacement, string subject)||string||Replace a regular expression pattern with replacement in subject, pattern and replacement can be arrays. The replaced subject is returned. See also preg_replace () for detailed description.|
|preg_split (string pattern, string subject, [, number limit=-1, number flags=0])||array||Split a subject with a regular expression pattern into substrings. If limit is specified only the limit of substrings are returned. flags can have following binary combined values: 1 = PREG_SPLIT_NO_EMPTY, 2 = PREG_SPLIT_DELIM_CAPTURE, 4 = PREG_SPLIT_OFFSET_CAPTURE. See also preg_split () for detailed description. On success an array with found substings is returned. On error false is returned.|