RegEx: Unterschied zwischen den Versionen
Aus Matts Wiki
Matt (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
Matt (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
| Zeile 27: | Zeile 27: | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ style="text-align: left" | Meaning of meta characters | |+ style="text-align: left" | Meaning of meta characters | ||
! | ! Meta Character !! Example | ||
|- | |- | ||
| Single Character || . | | Single Character || . | ||
| Zeile 43: | Zeile 43: | ||
| Inversion of character class range || [^abc] | | Inversion of character class range || [^abc] | ||
|- | |- | ||
| Grouping with alternatives || (Mon|Tues) day | | Grouping with alternatives || (Mon|Tues)day | ||
|- | |- | ||
| Word and text boundaries || b ^ $ | | Word and text boundaries || b ^ $ | ||
Version vom 30. August 2021, 13:51 Uhr
Notes for RegEx respectively Regular Expressions.
Guide (german): https://t3n.de/news/regex-guide-t3n-552858/
Quick Start Cheat Sheet: https://www.rexegg.com/regex-quickstart.html
Advanced tutorial: https://www.rexegg.com/regex-disambiguation.html
Practical tutorial: https://regexone.com/
Regex with JavaScript: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/#regular-expressions
Test Regex: https://regexr.com/
General Rules
| Type | Example |
|---|---|
| Literal | a b c 1 2 3 |
| Meta characters | . [[ ] { } ? * + | ( ) ^ $ |
| Meta Character | Example |
|---|---|
| Single Character | . |
| Character class digit | \d |
| Character class character | \w |
| Character class whitespace | \s |
| Inversion of character classes (Not) | \D, \W, \S |
| Character class range | [a-c] |
| Inversion of character class range | [^abc] |
| Grouping with alternatives | (Mon|Tues)day |
| Word and text boundaries | b ^ $ |
| Quantifiers | Example |
|---|---|
| Zero or one character | ? |
| Zero or more characters | * |
| One or more characters | + |
| Three characters | {3} |
| Four to 20 characters | {4,20} |
