Kanishk Sachan e3d80f59e2 fix: reject multiple patterns when -P/--perl-regexp is used
GNU grep's PCRE backend supports only a single pattern. Supplying
multiple patterns via repeated -e flags, or a pattern string that
contains a literal newline, must exit 2 with the message:

    the -P option only supports a single pattern

Add the validation immediately after patterns are collected, before
regex-mode selection. Add a test covering:
  - two separate -e flags with -P
  - a newline-embedded pattern string with -P
  - single -e with -P still works normally

Closes #34
2026-06-05 01:25:22 +01:00
2026-05-28 20:19:53 +02:00
2026-05-28 20:19:53 +02:00
2026-05-31 07:59:22 +00:00
2026-05-31 07:59:22 +00:00
2026-05-28 20:19:53 +02:00
2026-05-28 20:19:53 +02:00
2026-05-28 20:19:53 +02:00
2026-05-28 20:19:53 +02:00

Crates.io Discord License dependency status

CodeCov CodSpeed

Grep, now in Rust

A Rust implementation of GNU Grep. This project is an initial release and may contain bugs.

Install

cargo install uu_grep

Building

Download Rust at: https://rustup.rs/

# Check out this repository
git clone https://github.com/uutils/grep
cd grep

# Build a release version
cargo build --release

# Run!
./target/release/grep --help

# Run tests (if needed; after making changes)
cargo test

Pre-commit hooks

This project uses pre-commit; run pre-commit install to enable the git hooks.

Known Issues

  • Does not take LANG, etc., into account for handling file encodings (non-UTF8 matches are treated as binary)
  • No localization support yet
  • Performances need to be improved

Contributing

To contribute to uutils, please see CONTRIBUTING.

License

uutils is licensed under the MIT License - see the LICENSE file for details

GNU Grep is licensed under the GPL 3.0 or later.

S
Description
No description provided
Readme MIT 272 KiB
Languages
Rust 90.9%
Shell 6.4%
Python 2.7%