887 B
887 B
#Regex
I am by no means an expert when it comes to regex, this document will propbably have some inaccuracies in it but hey it is what it is :)
##What is regex?
Regex is shorthand for regular expressions, it is a system for pattern matching in text, when combined with commands it can be used for quite a lot of things
##Useful regex patterns
- . - Matches any char
- ^ - Matches at the start of a line
- $ - Matches at the end of a line
- ? - Matches once or none
- + - Matches once or more
- * - Matches zero or more times
- \d - Match any decimal (0-9)
- \b - Defines a word boundary
- {x} - Repeat exactly x times
- {x, y} - Repeat pattern x to y times
##Regex logic
- | - Logical OR, allows pattern1 OR pattern2 to match
- (x|y) - Matches a group of patterns
I have made a few examples here