user-documentation icon indicating copy to clipboard operation
user-documentation copied to clipboard

document regex syntax

Open jjergus opened this issue 4 years ago • 1 comments

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

jjergus avatar Jul 08 '20 18:07 jjergus

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

fredemmott avatar Jul 08 '20 20:07 fredemmott