klenwell information services : PhpRegex

PHP Regex Pages

DevPhp

Ungreedy Match

To simply match everything between to fixed strings. The core: (.*?). For some reason, I can't commit this to memory:
# DELIMITER START_FLAG (.*?) END_FLAG DELIMITER
$regex_p = '~#####(.*?)#####~';
$regex_p = sprintf('~%s(%s)%s~', preg_quote('<body>'), '.*?', preg_quote('</body>'));

See also Paste20100418

References

Pattern Syntax (php.net)