mkdocs-pages/docs/regex.md
2019-01-03 10:36:29 +11:00

26 lines
887 B
Markdown

#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](/examples/regexmatch)