Regular expressions pcre2 · Using regex in tools
Search with grep
Print lines made only of digits. -E enables extended regular expressions.
grep -E '^[0-9]+$' file.txt
Official Regular expressions pcre2 documentation
More using regex in tools commands
- Use lookarounds with grep
- Rewrite text with sed
- Match in JavaScript
- Replace in JavaScript
- Find all matches in Python
- Replace in Python
All using regex in tools commands · Regular expressions pcre2 cheatsheet