regex
Regular expressions (
regex) are patterns used to match, search, and manipulate text. Note:regexisn't a command, but syntax to be used with other commands. See also:egrep,glob. More information: https://cheatography.com/davechild/cheat-sheets/regular-expressions/.
- Match any single character:
.
- Match the start of a line:
^
- Match the end of a line:
$
- Match zero or more repeated characters:
*
- Match one character in a set of characters:
[]
- Match ranges of characters:
[][]
- Match anything but the specified character:
[^]
- Match a boundary around a word:
"\b\b"
来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
