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-->
---'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html