Search Tools
Table of Contents
Details
.ignore
Most search tools like ag
and rg
comply with .ignore
, which is formatted same as .gitignore
. Tools will ignore targets specified in .ignore
Expressions
. |
|
? |
|
* |
|
+ |
|
{n} |
|
{n,} |
|
{,m} |
|
{n,m} |
|
[:upper:] |
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
[:lower:] |
a b c d e f g h i j k l m n o p q r s t u v w x y z |
[:digit:] |
0 1 2 3 4 5 6 7 8 9 |
[:xdigit:] |
0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f |
[:punct:] |
! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { ¦ } ~ (Punctuation characters) |
[:blank:] |
space and tab |
[:space:] |
tab , newline , vertical tab , form feed , carriage return , and space |
[:alpha:] |
[:lower:] and [:upper:] ; same as [A-Za-z] |
[:alnum:] |
[:alpha:] and [:digit:] , same as [0-9A-Za-z] |
[:graph:] |
[:alnum:] and [:punct:] (Graphical characters) |
[:print:] |
[:alnum:] , [:punct:] , and space |
[:cntrl:] |
Octal codes 000 through 037 , and 177 (DEL) |
\b |
Match the empty string at the edge of a word |
\B |
Match the empty string provided it’s not at the edge of a word. |
\< |
Match the empty string at the beginning of word. |
\> |
Match the empty string at the end of word. |
\w |
A synonym for [_[:alnum:]] |
\W |
A synonym for [^_[:alnum:]] |
\s |
A synonym for [[:space:]] |
\S |
A synonym for [^[:space:]] |
(a)\1 |
Matches aa (Back references) |
a(.)¦b\1 |
will not match ba (Only groups participated in the match can be back-referenced) |
\<
,\>
is specific, while\b
can be placed at both ends- Meta-characters like
?
,+
,{
,|
,(
,)
should be escaped with backslashegrep
orgrep -E
will make these characters have meta meaning by default.
Meta Characters that require escaping when using as literal characters
PCRE, ERE, and other compatibles
- Tools like
ag
,rg
,egrep
,grep -E
- Common meta characters:
.^$*+?()[{\|
- Because
\
is a literal chracter inside character classes,^-]\
should be escaped by clever placement^
: Except at the start]
: At the start-
: At the start or the end of the character class
BRE (POSIX Basic Regular Expressions)
- Tools like
grep
- Only basical anchors and glob symbols:
.^$*