{"repo":"rust-lang/regex","free":true,"listed":false,"github":"https://github.com/rust-lang/regex","clone":"git clone https://github.com/rust-lang/regex.git","description":"An implementation of regular expressions for Rust. This implementation uses finite automata and guarantees linear time matching on all inputs.","language":"Rust","stars":4011,"topics":["regex","regexp","regular-expressions","regex-engine","regex-syntax","regex-parser","rust","dfa","nfa","automata"],"license":"Apache-2.0","category":"dev-tools","readme_excerpt":"regex ===== This crate provides routines for searching strings for matches of a [regular expression] (aka \"regex\"). The regex syntax supported by this crate is similar to other regex engines, but it lacks several features that are not known how to implement efficiently. This includes, but is not limited to, look-around and backreferences. In exchange, all regex searches in this crate have worst case O(m n) time complexity, where m is proportional to the size of the regex and n is proportional to the size of the string being searched. [regular expression]: https://en.wikipedia.org/wiki/Regular expression Documentation Module documentation with examples. The module documentation also includes a comprehensive description of the syntax supported. Documentation with examples for the various matching functions and iterators can be found on the Regex type. Usage To bring this crate into your repository, either add regex to your Cargo.toml , or run cargo add regex . Here's a simple example that matches a date in YYYY-MM-DD format and prints the year, month and day: If you have lots of dates in text that you'd like to iterate over, then it's easy to adapt the above example with an iterator: Usage: Avoid compiling the same regex in a loop It is an anti-pattern to compile the same regular expression in a loop since compilation is typically expensive. (It takes anywhere from a few microseconds to a few milliseconds depending on the size of the regex.) Not only is compilation itself expen","default_branch":null,"files":null,"tree":[],"storefront":"/r/rust-lang","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/rust-lang/regex/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}