Use equivalent regex with PCRE

Use the equivalent regex with PCRE.

`[0-9]*` (and `\d*`) will output each integer, e.g.:

```bash
echo 17 | grep -o '[0-9]*'
```

Whereas `\d` will split it into digits, e.g.:

```bash
echo 17 | grep -oP '\d'
```

Signed-off-by: Linus G Thiel <linus@yesbabyyes.se>
This commit is contained in:
Linus G Thiel 2022-05-03 21:54:42 +02:00 committed by Linus Thiel
parent c2b96736bd
commit a97dcf2a3b

View File

@ -280,7 +280,7 @@ grep -c "^$"
```bash ```bash
grep -o '[0-9]*' grep -o '[0-9]*'
#or #or
grep -oP '\d' grep -oP '\d*'
``` ```
##### Grep integer with certain number of digits (e.g. 3) ##### Grep integer with certain number of digits (e.g. 3)
```bash ```bash