$re = '/<!--.*?-->\n{2}(?!---)/m';
$str = '### Alias
Q: what check to do before creating an alias?
A: check whether any other command exists by that name using `type new-alias-name`
<!--ID: 1643091253375-->
---
Q: syntax to create an alias?
A: `alias name=\'string\'`
<!--ID: 1645446702965-->
- no spaces before or after the equal sign
- single quotes around the command sequence
![[Pasted image 20220125092954.png]]
<!--ID: 1643091253408-->
---
### Redirection/Piping
Q: output of `> ls-output.txt`
A: the file will be truncated if it exists or it would be created.
<!--ID: 1645087988730-->
- Simply using the redirection operator with no command preceding it will truncate an existing file or create a new empty file
<!--ID: 1643351731943-->
---';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php