2025-03-14 21:59:59 -06:00
|
|
|
# grex
|
|
|
|
|
|
2025-09-14 18:48:49 -06:00
|
|
|
> Generate `regex`s.
|
2025-03-14 21:59:59 -06:00
|
|
|
> More information: <https://github.com/pemistahl/grex>.
|
|
|
|
|
|
2025-09-14 18:48:49 -06:00
|
|
|
- Generate a simple `regex`:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`grex {{string1 string2 ...}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-09-14 18:48:49 -06:00
|
|
|
- Generate a case-insensitive `regex`:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`grex {{[-i|--ignore-case]}} {{string1 string2 ...}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Replace digits with `\d`:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`grex {{[-d|--digits]}} {{string1 string2 ...}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Replace Unicode word character with `\w`:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`grex {{[-w|--words]}} {{string1 string2 ...}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Replace spaces with `\s`:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`grex {{[-s|--spaces]}} {{string1 string2 ...}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Detect repeating patterns in the input and shorten them using {min,max} quantifiers:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`grex {{[-r|--repetitions]}} {{string1 string2 ...}}`
|
|
|
|
|
|
|
|
|
|
- Generate `regex` of test cases (separated by newline) from a file:
|
|
|
|
|
|
|
|
|
|
`grex {{[-f|--file]}} {{path/to/file}}`
|
|
|
|
|
|
|
|
|
|
- Do not generate anchors and non-capture groups:
|
|
|
|
|
|
|
|
|
|
`grex --no-anchors {{[-g|--capture-groups]}} {{string1 string2 ...}}`
|