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