# Fossil's Internal 'grep' Command
As of Fossil 2.7, there is a `grep` command which acts something like
POSIX's `grep -E` over all historical versions of a single file name.
This document explains the commonalities and divergences between POSIX
`grep` and Fossil `grep`.
## Options
................................................................................
| Option | Meaning
|--------|-------------------------------------------------------------
| `-i` | ignore case in matches
| `-l` | list a checkin ID prefix for matching historical versions of the file
| `-v` | print each checkin ID considered, regardless of whether it matches
No equivalent of other POSIX `grep` options currently exist. Patches to
remove those limitations will be thoughtfully considered.
## Regular Expression Dialect
Fossil contains a built-in regular expression engine implementing a
subset of the [POSIX extended regular expression][ere] dialect:
................................................................................
There are several restrictions in Fossil `grep` relative to a fully
POSIX compatible regular expression engine. Among them are:
* There is currently no support for POSIX character classes such as
`[:lower:]`.
* Fossil does not currently attempt to take your operating system's
locale settings into account when doing this match. Fossil alsocurrently has no way to mark a given file as having a particular
encoding.
Instead, Fossil `grep` assumes the input files are in UTF-8 format,so it will not work correctly if the files in your repository are in
an encoding that is not backwards-compatible with ASCII, such as
UTF-16. Partially compatible encodings such as ISO 8859 should work
with Fossil `grep` as long as you stick to their ASCII-compatible
subset.
The Fossil `grep` language is not a strict subset of POSIX extended
regular expressions. Some of the features documented above are
well-understood extensions to it, such as the "word" features `\b`, `\w`
and `\W`.
Fossil `grep` is based on the Unicode engine from [SQLite's FTS5

# Fossil grep vs POSIX grep
As of Fossil 2.7, there is a `grep` command which acts roughly like
POSIX's `grep -E` over all historical versions of a single file name.
This document explains the commonalities and divergences between POSIX
`grep` and Fossil `grep`.
## Options
................................................................................
| Option | Meaning
|--------|-------------------------------------------------------------
| `-i` | ignore case in matches
| `-l` | list a checkin ID prefix for matching historical versions of the file
| `-v` | print each checkin ID considered, regardless of whether it matches
No equivalent of other POSIX `grep` options currently exist.
Note in partcicular that there is no equivalent of `grep -R`, eitherimplicitly or explicitly. Fossil `grep` currently accepts only a singleinput file name. You cannot give it a list of file names, and you cannotgive it a a directory name for Fossil to expand to the set of all filesunder that directory.Patches to remove those limitations will be thoughtfully considered.
## Regular Expression Dialect
Fossil contains a built-in regular expression engine implementing a
subset of the [POSIX extended regular expression][ere] dialect:
................................................................................
There are several restrictions in Fossil `grep` relative to a fully
POSIX compatible regular expression engine. Among them are:
* There is currently no support for POSIX character classes such as
`[:lower:]`.
* Fossil `grep` does not currently attempt to take your operating
system's locale settings into account when doing this match. SinceFossil has no way to mark a given file as having a particular
encoding, Fossil `grep` assumes the input files are in UTF-8 format.
This means Fossil `grep` will not work correctly if the files in
your repository are in an encoding that is not backwards-compatible
with ASCII, such as UTF-16. Partially compatible encodings such as
ISO 8859 should work with Fossil `grep` as long as you stick to
their ASCII-compatible subset.
The Fossil `grep` language is not a strict subset of POSIX extended
regular expressions. Some of the features documented above are
well-understood extensions to it, such as the "word" features `\b`, `\w`
and `\W`.
Fossil `grep` is based on the Unicode engine from [SQLite's FTS5

This page was generated in about
0.005s by
Fossil 2.9 [7abfca6752] 2019-03-18 12:04:02