Files
cheatsheet-tldr/tldr/regex
2026-01-10 00:21:47 +00:00

43 lines
740 B
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# regex
> Regular expressions (`regex`) are patterns used to match, search, and manipulate text.
> Note: `regex` isn't a command, but syntax to be used with other commands.
> More information: <https://cheatography.com/davechild/cheat-sheets/regular-expressions/>.
- Match any single character:
`.`
- Match the start of a line:
`^{{hello}}`
- Match the end of a line:
`{{world}}$`
- Match zero or more repeated characters:
`{{a}}*`
- Match a set of characters:
`[{{abc}}]`
- Match ranges of characters:
`[{{a-z}}][{{3-9}}]`
- Match anything but the specified character:
`[^{{a}}]`
- Match a boundary around a word:
`"{{text}}"`