[][src]Crate libgrep_rs

grep-rs is a simple tool for searching through text

Currently Working Features

  • Support for searching through files
  • Support for searching through standard input
  • Searching through text that includes specific patterns
  • Searching through text that excludes specific patterns
  • Printing all lines before the first instance of the pattern
  • Printing all lines after the first instance of the pattern
  • Case Insensitivity
  • Simple Regular Expressions


Add this to your Cargo.toml

libgrep-rs = "0.1.3"


use libgrep_rs::searcher::Searcher;
use libgrep_rs::options::Options;

fn main() {
    let options = Options::default();
    let text = String::from("Hello World\n libgrep-rs test");
    let pattern = String::from("World");
    let searcher = Searcher::new(pattern, text, options, Some(String::from("\n")));
    //Some(String::from("\n")) is the deliminator, it could be anything
    //If set to None, it will use the default "\n"
    let output = searcher.search();
    println!("{}", output);

If it worked, the output will be

Hello World

You can see other examples in the examples/ directory



Contains structs required for the configuration of the searcher module


Contains structs used for searching through text