Basic and naive implementation of string basic pattern matching algorithms.
To run, install the Rust toolchain. Cargo may be used to compile the source.
Usage,
$ cargo run -q -- --help
Usage: patmat [OPTIONS] <PATTERN>
Arguments:
<PATTERN>
The pattern
Options:
-a <ALGORITHM>
The pattern matching algorithm
[default: shift-and]
[possible values: rabin-karp, shift-and]
--stats
Whether the program should show statistics
-i <INPUT>
The file to perform the search.
If not passed, will read from the stdin.
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
Example,
$ cargo run -q -- --stats -i Cargo.toml path
80
108
146
(done in 20 μs)