1[package] 2name = "regex" 3version = "1.7.1" #:version 4authors = ["The Rust Project Developers"] 5license = "MIT OR Apache-2.0" 6readme = "README.md" 7repository = "https://github.com/rust-lang/regex" 8documentation = "https://docs.rs/regex" 9homepage = "https://github.com/rust-lang/regex" 10description = """ 11An implementation of regular expressions for Rust. This implementation uses 12finite automata and guarantees linear time matching on all inputs. 13""" 14categories = ["text-processing"] 15autotests = false 16exclude = ["/scripts/*", "/.github/*"] 17edition = "2018" 18 19[workspace] 20members = [ 21 "bench", "regex-capi", "regex-debug", "regex-syntax", 22] 23 24[lib] 25# There are no benchmarks in the library code itself 26bench = false 27# Doc tests fail when some features aren't present. The easiest way to work 28# around this is to disable automatic doc testing, but explicitly test them 29# with `cargo test --doc`. 30doctest = false 31 32# Features are documented in the "Crate features" section of the crate docs: 33# https://docs.rs/regex/*/#crate-features 34[features] 35default = ["std", "perf", "unicode", "regex-syntax/default"] 36 37# ECOSYSTEM FEATURES 38 39# The 'std' feature permits the regex crate to use the standard library. This 40# is intended to support future use cases where the regex crate may be able 41# to compile without std, and instead just rely on 'core' and 'alloc' (for 42# example). Currently, this isn't supported, and removing the 'std' feature 43# will prevent regex from compiling. 44std = [] 45# The 'use_std' feature is DEPRECATED. It will be removed in regex 2. Until 46# then, it is an alias for the 'std' feature. 47use_std = ["std"] 48 49 50# PERFORMANCE FEATURES 51 52# Enables all performance features. 53perf = ["perf-cache", "perf-dfa", "perf-inline", "perf-literal"] 54# Enables fast caching. (If disabled, caching is still used, but is slower.) 55# Currently, this feature has no effect. It used to remove the thread_local 56# dependency and use a slower internal cache, but now the default cache has 57# been improved and thread_local is no longer a dependency at all. 58perf-cache = [] 59# Enables use of a lazy DFA when possible. 60perf-dfa = [] 61# Enables aggressive use of inlining. 62perf-inline = [] 63# Enables literal optimizations. 64perf-literal = ["aho-corasick", "memchr"] 65 66 67# UNICODE DATA FEATURES 68 69# Enables all Unicode features. This expands if new Unicode features are added. 70unicode = [ 71 "unicode-age", 72 "unicode-bool", 73 "unicode-case", 74 "unicode-gencat", 75 "unicode-perl", 76 "unicode-script", 77 "unicode-segment", 78 "regex-syntax/unicode", 79] 80# Enables use of the `Age` property, e.g., `\p{Age:3.0}`. 81unicode-age = ["regex-syntax/unicode-age"] 82# Enables use of a smattering of boolean properties, e.g., `\p{Emoji}`. 83unicode-bool = ["regex-syntax/unicode-bool"] 84# Enables Unicode-aware case insensitive matching, e.g., `(?i)β`. 85unicode-case = ["regex-syntax/unicode-case"] 86# Enables Unicode general categories, e.g., `\p{Letter}` or `\pL`. 87unicode-gencat = ["regex-syntax/unicode-gencat"] 88# Enables Unicode-aware Perl classes corresponding to `\w`, `\s` and `\d`. 89unicode-perl = ["regex-syntax/unicode-perl"] 90# Enables Unicode scripts and script extensions, e.g., `\p{Greek}`. 91unicode-script = ["regex-syntax/unicode-script"] 92# Enables Unicode segmentation properties, e.g., `\p{gcb=Extend}`. 93unicode-segment = ["regex-syntax/unicode-segment"] 94 95 96# UNSTABLE FEATURES (requires Rust nightly) 97 98# A blanket feature that governs whether unstable features are enabled or not. 99# Unstable features are disabled by default, and typically rely on unstable 100# features in rustc itself. 101unstable = ["pattern"] 102 103# Enable to use the unstable pattern traits defined in std. This is enabled 104# by default if the unstable feature is enabled. 105pattern = [] 106 107# For very fast prefix literal matching. 108[dependencies.aho-corasick] 109version = "0.7.18" 110optional = true 111 112# For skipping along search text quickly when a leading byte is known. 113[dependencies.memchr] 114version = "2.4.0" 115optional = true 116 117# For parsing regular expressions. 118[dependencies.regex-syntax] 119path = "regex-syntax" 120version = "0.6.27" 121default-features = false 122 123[dev-dependencies] 124# For examples. 125lazy_static = "1" 126# For property based tests. 127quickcheck = { version = "1.0.3", default-features = false } 128# For generating random test data. 129rand = { version = "0.8.3", default-features = false, features = ["getrandom", "small_rng"] } 130# To check README's example 131# TODO: Re-enable this once the MSRV is 1.43 or greater. 132# See: https://github.com/rust-lang/regex/issues/684 133# See: https://github.com/rust-lang/regex/issues/685 134# doc-comment = "0.3" 135 136# Run the test suite on the default behavior of Regex::new. 137# This includes a mish mash of NFAs and DFAs, which are chosen automatically 138# based on the regex. We test both of the NFA implementations by forcing their 139# usage with the test definitions below. (We can't test the DFA implementations 140# in the same way since they can't be used for every regex tested.) 141[[test]] 142path = "tests/test_default.rs" 143name = "default" 144 145# The same as the default tests, but run on bytes::Regex. 146[[test]] 147path = "tests/test_default_bytes.rs" 148name = "default-bytes" 149 150# Run the test suite on the NFA algorithm over Unicode codepoints. 151[[test]] 152path = "tests/test_nfa.rs" 153name = "nfa" 154 155# Run the test suite on the NFA algorithm over bytes that match UTF-8 only. 156[[test]] 157path = "tests/test_nfa_utf8bytes.rs" 158name = "nfa-utf8bytes" 159 160# Run the test suite on the NFA algorithm over arbitrary bytes. 161[[test]] 162path = "tests/test_nfa_bytes.rs" 163name = "nfa-bytes" 164 165# Run the test suite on the backtracking engine over Unicode codepoints. 166[[test]] 167path = "tests/test_backtrack.rs" 168name = "backtrack" 169 170# Run the test suite on the backtracking engine over bytes that match UTF-8 171# only. 172[[test]] 173path = "tests/test_backtrack_utf8bytes.rs" 174name = "backtrack-utf8bytes" 175 176# Run the test suite on the backtracking engine over arbitrary bytes. 177[[test]] 178path = "tests/test_backtrack_bytes.rs" 179name = "backtrack-bytes" 180 181# Run all backends against each regex found on crates.io and make sure 182# that they all do the same thing. 183[[test]] 184path = "tests/test_crates_regex.rs" 185name = "crates-regex" 186 187[profile.release] 188debug = true 189 190[profile.bench] 191debug = true 192 193[profile.test] 194debug = true 195