HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

regex — Regular expressions (`regex`) are patterns used to match, search, and manipulate text. Note: `regex`

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandregularexpressionsareregexpatternscli

Problem

How to use the regex command: 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/>.

Solution

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:
"\b{{text}}\b"

Code Snippets

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}}]

Context

tldr-pages: common/regex

Revisions (0)

No revisions yet.