2 unstable releases

0.1.0 Feb 25, 2021
0.0.1 Aug 2, 2019

#520 in Text processing

Download history 707029/week @ 2023-12-16 357386/week @ 2023-12-23 612632/week @ 2023-12-30 793572/week @ 2024-01-06 822017/week @ 2024-01-13 827416/week @ 2024-01-20 893777/week @ 2024-01-27 920814/week @ 2024-02-03 947440/week @ 2024-02-10 919579/week @ 2024-02-17 978839/week @ 2024-02-24 994834/week @ 2024-03-02 946694/week @ 2024-03-09 970031/week @ 2024-03-16 953913/week @ 2024-03-23 827385/week @ 2024-03-30

3,852,477 downloads per month
Used in 4,217 crates (2 directly)

MIT license

363 lines


Regular expression matching on Rust streams.

Crates.io Documentation MIT licensed CI


The regex crate implements regular expression matching on strings and byte arrays. However, in order to match the output of implementations of fmt::Debug and fmt::Display, or by any code which writes to an instance of fmt::Write or io::Write, it is necessary to first allocate a buffer, write to that buffer, and then match the buffer against a regex.

In cases where it is not necessary to extract substrings, but only to test whether or not output matches a regex, it is not strictly necessary to allocate and write this output to a buffer. This crate provides a simple interface on top of the lower-level regex-automata library that implements fmt::Write and io::Write for regex patterns. This may be used to test whether streaming output matches a pattern without buffering that output.

Users who need to extract substrings based on a pattern or who already have buffered data should probably use the regex crate instead.


~27K SLoC