From fcd185303198f9a6c8026e0a632c84bacf36e779 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Tue, 21 Aug 2018 21:24:02 -0400 Subject: [PATCH] doc: update ripgrep's description This now mentions PCRE2 support. --- doc/rg.1.txt.tpl | 26 ++++++++++++++++++-------- src/app.rs | 11 ++++++----- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/doc/rg.1.txt.tpl b/doc/rg.1.txt.tpl index ab1ef78f..558aadc3 100644 --- a/doc/rg.1.txt.tpl +++ b/doc/rg.1.txt.tpl @@ -28,27 +28,37 @@ Synopsis DESCRIPTION ----------- ripgrep (rg) recursively searches your current directory for a regex pattern. -By default, ripgrep will respect your `.gitignore` and automatically skip -hidden files/directories and binary files. +By default, ripgrep will respect your .gitignore and automatically skip hidden +files/directories and binary files. -ripgrep's regex engine uses finite automata and guarantees linear time -searching. Because of this, features like backreferences and arbitrary -lookaround are not supported. +ripgrep's default regex engine uses finite automata and guarantees linear +time searching. Because of this, features like backreferences and arbitrary +look-around are not supported. However, if ripgrep is built with PCRE2, then +the --pcre2 flag can be used to enable backreferences and look-around. + +ripgrep supports configuration files. Set RIPGREP_CONFIG_PATH to a +configuration file. The file can specify one shell argument per line. Lines +starting with '#' are ignored. For more details, see the man page or the +README. REGEX SYNTAX ------------ -ripgrep uses Rust's regex engine, which documents its syntax: -https://docs.rs/regex/0.2.5/regex/#syntax +ripgrep uses Rust's regex engine by default, which documents its syntax: +https://docs.rs/regex/*/regex/#syntax ripgrep uses byte-oriented regexes, which has some additional documentation: -https://docs.rs/regex/0.2.5/regex/bytes/index.html#syntax +https://docs.rs/regex/*/regex/bytes/index.html#syntax To a first approximation, ripgrep uses Perl-like regexes without look-around or backreferences. This makes them very similar to the "extended" (ERE) regular expressions supported by `egrep`, but with a few additional features like Unicode character classes. +If you're using ripgrep with the --pcre2 flag, then please consult +https://www.pcre.org or the PCRE2 man pages for documentation on the supported +syntax. + POSITIONAL ARGUMENTS -------------------- diff --git a/src/app.rs b/src/app.rs index a776abec..35009fca 100644 --- a/src/app.rs +++ b/src/app.rs @@ -13,12 +13,13 @@ use clap::{self, App, AppSettings}; const ABOUT: &str = " ripgrep (rg) recursively searches your current directory for a regex pattern. -By default, ripgrep will respect your `.gitignore` and automatically skip -hidden files/directories and binary files. +By default, ripgrep will respect your .gitignore and automatically skip hidden +files/directories and binary files. -ripgrep's regex engine uses finite automata and guarantees linear time -searching. Because of this, features like backreferences and arbitrary -lookaround are not supported. +ripgrep's default regex engine uses finite automata and guarantees linear +time searching. Because of this, features like backreferences and arbitrary +look-around are not supported. However, if ripgrep is built with PCRE2, then +the --pcre2 flag can be used to enable backreferences and look-around. ripgrep supports configuration files. Set RIPGREP_CONFIG_PATH to a configuration file. The file can specify one shell argument per line. Lines