From wikistone
(Created page with "Regular expressions: the skill of the marriage of linguistics and computer logic. ==RegEx Special Chars== ===Meta Chars=== * ^ : the beginning of a line ** ^derp : matches 'd...") |
|||
| Line 21: | Line 21: | ||
==Examples== | ==Examples== | ||
Given file.txt : | Given file.txt : | ||
| − | < | + | <pre> |
rabbit | rabbit | ||
fox | fox | ||
| Line 31: | Line 31: | ||
murp11 | murp11 | ||
gnu3a | gnu3a | ||
| − | </ | + | </pre> |
...add some examples | ...add some examples | ||
Latest revision as of 22:51, 30 December 2013
Regular expressions: the skill of the marriage of linguistics and computer logic.
RegEx Special Chars
Meta Chars
- ^ : the beginning of a line
- ^derp : matches 'derp flurp' but not 'flurp derp'
- $ : the end of a line
- derp$ : matches 'flurp derp' but not 'derp flurp'
- . : any char (except newline)
Quantifiers
- * : 0+ of prev char
- + : 1+ of prev char
- ? : 1 of prev char
Quantifiers must be escaped in the expression with '\'.
Char Classes
- [0-9] : numerics
- [a-z] : lowercase
- [A-Z] : uppers
Char classes match one char only each.
Examples
Given file.txt :
rabbit fox rabbit fox fox rabbit deer moose murp1 murp11 gnu3a
...add some examples