Regex

A **Regex** oda **Regular Expression** (boarisch: *Regulära Ausdruck*) is a Sequenz vo Zoachn, wo a Suachmusta definiad.

Regex wean in da Softwareentwicklung vawendd owa aa in Texteditorn, wo s zan Suacha und Dasetzn vo Zoachnkeedn vawendd wean. So konst in ana Wikipedia olle Weata aussasuacha, wo mit A oofanga und mid -bichl afhean. Do is wuascht, wejchane Zoachn dazwischn liegn. Sowos geht nua mid an Regex.

D Syntax vo d Regex variiad a wengal zwischn vaschiednan Apps.

## Praxis

### Oafoche Regex

#### Beispui
* "^[MH]uad"
** Driffd *Muad* und *Huad* owa nua am Ofang vo ana Zein.
* "[MH]uad$"
** Driffd *Muad* und *Huad* owa nua am End vo ana Zein.

### Zoachnauswoi

### Zoachnklassn
Es gibt Zoachnklassn, wo fiadefiniat san. Des wead owa ned in oin Implementiarunga glei untastitzt.
Zoachnklassn san beispuisweis:

#### Zoachnklassn noch POSIX-Standard

{| class="wikitable sortable"
|-
! POSIX !! Ned-Standard !! Perl/Tcl !! Vim !! Java !! ASCII !! Bschrieb
|-
|
|
```ragel
[:ascii:]
```

|
|
| 
```ragel
\p{ASCII}
```

| 
```ragel
[\x00-\x7F]
```

| ASCII characters (ASCII Zoachn)
|-
| 
```ragel
[:alnum:]
```

|
|
|
| 
```ragel
\p{Alnum}
```

| 
```ragel
[A-Za-z0-9]
```

| Alphanumeric characters (alphanumerische Zoachn)
|-
|
| 
```ragel
[:word:]
```

| 
```ragel
\w
```

| 
```ragel
\w
```

| 
```ragel
\w
```

| 
```ragel
[A-Za-z0-9_]
```

| Alphanumeric characters plus "_" (alphanum. Zoachn plus "_")
|-
|
|
| 
```ragel
\W
```

| 
```ragel
\W
```

| 
```ragel
\W
```

| 
```ragel
[^A-Za-z0-9_]
```

| Non-word characters (Ned-Woat Zoachn)
|-
| 
```ragel
[:alpha:]
```

|
|
| 
```ragel
\a
```

| 
```ragel
\p{Alpha}
```

| 
```ragel
[A-Za-z]
```

| Alphabetic characters (Buachstom)
|-
| 
```ragel
[:blank:]
```

|
|
| 
```ragel
\s
```

| 
```ragel
\p{Blank}
```

| 
```ragel
[ [[\t]]]
```

| Space and tab (Laazoachn und Tabs)
|-
|
|
| 
```ragel
\b
```

| `\&lt; \&gt;`
| 
```ragel
\b
```

| 
```ragel
(?<=\W)(?=\w)|(?<=\w)(?=\W)
```

| Word boundaries (Woatgrenzn)
|-
|
|
|
|
| 
```ragel
\B
```

| 
```ragel
(?<=\W)(?=\W)|(?<=\w)(?=\w)
```

| Non-word boundaries (Ned-Woat-Grenzn)
|-
| 
```ragel
[:cntrl:]
```

|
|
|
| 
```ragel
\p{Cntrl}
```

| 
```ragel
[\x00-\x1F\x7F]
```

| Control characters (Steiazoachn)
|-
| 
```ragel
[:digit:]
```

|
| 
```ragel
\d
```

| 
```ragel
\d
```

| 
```ragel
\p{Digit}
```
 or 
```ragel
\d
```

| 
```ragel
[0-9]
```

| Digits (Ziffan)
|-
|
|
| 
```ragel
\D
```

| 
```ragel
\D
```

| 
```ragel
\D
```

| 
```ragel
[^0-9]
```

| Non-digits (Ned-Ziffan)
|-
| 
```ragel
[:graph:]
```

|
|
|
| 
```ragel
\p{Graph}
```

| 
```ragel
[\x21-\x7E]
```

| Visible characters (Sichtbore Zoachn)
|-
| 
```ragel
[:lower:]
```

|
|
| 
```ragel
\l
```

| 
```ragel
\p{Lower}
```

| 
```ragel
[a-z]
```

| Lowercase letters (kloane Buachstom)
|-
| 
```ragel
[:print:]
```

|
|
| 
```ragel
\p
```

| 
```ragel
\p{Print}
```

| 
```ragel
[\x20-\x7E]
```

| Visible characters and the space character (Sichtbore Zoachn & Laazoachn)
|-
| 
```ragel
[:punct:]
```

|
|
|
| 
```ragel
\p{Punct}
```

| [][!"#$%&'()*+,./:;?@\^_`

### Quantifier
Quantifier (*Quantifiziara* oda *Wiedahoifaktorn*) legn fest, wia oft a Ausdruck, oiso a vurigs Zoachn bzw. a vurige Zoachnkeedn zuaglossn is.

#### Beispui
* `a+` is „a“ owa aa „aaaa“
* `[0-9]+` is „0123456789“ owa aa „072345“
* `[ab]+` is „a“, „b“, „aa“, „bbaab“ usw.
* `[0-9]{2,5}` is mindastns zwoa und maximai 5 Ziffan, z. B. „91“ oder „63091“

### Praktische Beispui

## Beleg


## Im Netz
* Reguläre Sprochn, reguläre Ausdrick
* POSIX specification of regular expressions
* Perl syntax for regular expressions
* Regex-Kurs fia Ofenga
* Regex guide

### Software
* Online visual regex tester
* Online regex tester
* Online regex tester – Visualisiarung