user-documentation
user-documentation copied to clipboard
document regex syntax
We should have a guide that documents:
-
re"..."
literals (Hack-specific feature) - overview of the
HH\Lib\Regex
namespace from HSL, link to relevant API docs pages - link to an authoritative reference for PCRE regex syntax (e.g. https://www.pcre.org/original/doc/html/pcresyntax.html)
- delimiter syntax (inherited from PHP: https://www.php.net/manual/en/regexp.reference.delimiters.php)
- modifier syntax (also inherited from PHP: https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php -- but we don't support all of them so need our own list)
- source: https://github.com/facebook/hhvm/blob/master/hphp/runtime/base/preg.cpp#L775
List of supported modifiers at https://github.com/facebook/hhvm/blob/master/hphp/runtime/base/preg.cpp
delimiter/modifier syntax largely inherited from perl - e.g. also in perl, ruby (%r), vim, etc