These examples and exercises pertain to the .NET flavor of Regex, which is what we use in Magnet AXIOM to perform advanced searches and column filters.
- Regex is complex.
- Use case in forensics.
- .NET Regex vs. other variants.
- Advanced searches and column filters in AXIOM.
- Regex testers.
- Universal Truth about Regex.
- Interest in more Regex content?
If you would like to use the same dataset as in the exercise, you can download them here:
Mock SQLite Dataset from Mockaroo
String and word boundaries with \b, ^, and $
Escaping special characters
Grouping and the use of Logical 'Or'
Numbers and letters'es, anchoring
Quantifiers - the specific and the indefinite
This reference guide lists some common .NET regex constructs, particularly the ones covered in the Tips and Tricks session on August 13.
Construct | Usage |
---|---|
[123] | Matches any single character matching 1, 2, or 3. |
[123]{5} | Matches exactly 5 consecutive characters matching 1, 2, or 3. |
[abc]{3,6} | Matches between 3 to 6 consecutive characters matching a, b, or c. |
[def]{3,} | Matches atleast 3 consecutive characters matching d, e, or f. |
[0-9]* | Matches zero or more numeric digits between 0-9. |
[0-9]+ | Matches one or more numeric digits between 0-9. |
[A-Z]s?$ | Matches any character A-Z, optionally including an 's' before the end of the string. |
^(one|two) | Matches the word one or two at the beginning of the string. |
\bsearch\b | Matches the word search but only when it is between word boundaries (spaces, punctuation, start or end of line) |
[\w\W]*? | Mike's Favorite - Match an indefinite number of, well, anything, terminating at the earliest opportunity. |
Regex Keyword examples - Magnet blog by Jamie McQuaid
Keywords for PII in Magnet AXIOM - Magnet blog by Tarah Melton
.NET Regular Expression Language Quick Reference - from Microsoft
Character Escapes in .NET Regular Expressions - from Microsoft
Regex Hero - .NET Regex Tester
Mockaroo (fantastic website used for mock test data generation)
My twitter handle is @forensicmike1 and DM's are open!