Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regex: add cheatsheet #209

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions regex
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
tags: [ patterns ]
---

<char|pattern>? match 0..1 characters or patterns (`?` must be escaped in GNU sed BRE)
<char|pattern>* match 0..more characters or patterns
<char|pattern>+ match 1..more characters or patterns (`+` must be escaped in GNU sed BRE)

<char|pattern>{<count>} match `count` characters or patterns (`{` and `}` must be escaped in GNU sed BRE)
<char|pattern>{<from..to>} match `from`..`to` characters or patterns (`{` and `}` must be escaped in GNU sed BRE)

[<characters>] match any mentioned character
[^<characters>] match any not mentioned character

# We don't distinguish between single char patterns below and complex patterns:

^<pattern> match the beggining of a string
<pattern>$ match the end of a string

(<pattern1>|<pattern2>) match any of two patterns (`|` must be escaped in GNU sed BRE)