1 | [package] |
2 | name = "regex" |
3 | version = "1.10.3" #:version |
4 | authors = ["The Rust Project Developers" , "Andrew Gallant <jamslam@gmail.com>" ] |
5 | license = "MIT OR Apache-2.0" |
6 | readme = "README.md" |
7 | repository = "https://github.com/rust-lang/regex" |
8 | documentation = "https://docs.rs/regex" |
9 | homepage = "https://github.com/rust-lang/regex" |
10 | description = "" " |
11 | An implementation of regular expressions for Rust. This implementation uses |
12 | finite automata and guarantees linear time matching on all inputs. |
13 | " "" |
14 | categories = ["text-processing" ] |
15 | autotests = false |
16 | exclude = ["/scripts/*" , "/.github/*" ] |
17 | edition = "2021" |
18 | rust-version = "1.65" |
19 | |
20 | [workspace] |
21 | members = [ |
22 | "regex-automata" , |
23 | "regex-capi" , |
24 | "regex-cli" , |
25 | "regex-lite" , |
26 | "regex-syntax" , |
27 | "regex-test" , |
28 | ] |
29 | |
30 | # Features are documented in the "Crate features" section of the crate docs: |
31 | # https://docs.rs/regex/*/#crate-features |
32 | [features] |
33 | default = ["std" , "perf" , "unicode" , "regex-syntax/default" ] |
34 | |
35 | # ECOSYSTEM FEATURES |
36 | |
37 | # The 'std' feature permits the regex crate to use the standard library. This |
38 | # is intended to support future use cases where the regex crate may be able |
39 | # to compile without std, and instead just rely on 'core' and 'alloc' (for |
40 | # example). Currently, this isn't supported, and removing the 'std' feature |
41 | # will prevent regex from compiling. |
42 | std = [ |
43 | "aho-corasick?/std" , |
44 | "memchr?/std" , |
45 | "regex-automata/std" , |
46 | "regex-syntax/std" , |
47 | ] |
48 | # This feature enables the 'log' crate to emit messages. This is usually |
49 | # only useful for folks working on the regex crate itself, but can be useful |
50 | # if you're trying hard to do some performance hacking on regex patterns |
51 | # themselves. Note that you'll need to pair this with a crate like 'env_logger' |
52 | # to actually emit the log messages somewhere. |
53 | logging = [ |
54 | "aho-corasick?/logging" , |
55 | "memchr?/logging" , |
56 | "regex-automata/logging" , |
57 | ] |
58 | # The 'use_std' feature is DEPRECATED. It will be removed in regex 2. Until |
59 | # then, it is an alias for the 'std' feature. |
60 | use_std = ["std" ] |
61 | |
62 | |
63 | # PERFORMANCE FEATURES |
64 | |
65 | # Enables all default performance features. Note that this specifically does |
66 | # not include perf-dfa-full, because it leads to higher compile times and |
67 | # bigger binaries, and the runtime performance improvement is not obviously |
68 | # worth it. |
69 | perf = [ |
70 | "perf-cache" , |
71 | "perf-dfa" , |
72 | "perf-onepass" , |
73 | "perf-backtrack" , |
74 | "perf-inline" , |
75 | "perf-literal" , |
76 | ] |
77 | # Enables use of a lazy DFA when possible. |
78 | perf-dfa = ["regex-automata/hybrid" ] |
79 | # Enables use of a fully compiled DFA when possible. |
80 | perf-dfa-full = ["regex-automata/dfa-build" , "regex-automata/dfa-search" ] |
81 | # Enables use of the one-pass regex matcher, which speeds up capture searches |
82 | # even beyond the backtracker. |
83 | perf-onepass = ["regex-automata/dfa-onepass" ] |
84 | # Enables use of a bounded backtracker, which speeds up capture searches. |
85 | perf-backtrack = ["regex-automata/nfa-backtrack" ] |
86 | # Enables aggressive use of inlining. |
87 | perf-inline = ["regex-automata/perf-inline" ] |
88 | # Enables literal optimizations. |
89 | perf-literal = [ |
90 | "dep:aho-corasick" , |
91 | "dep:memchr" , |
92 | "regex-automata/perf-literal" , |
93 | ] |
94 | # Enables fast caching. (If disabled, caching is still used, but is slower.) |
95 | # Currently, this feature has no effect. It used to remove the thread_local |
96 | # dependency and use a slower internal cache, but now the default cache has |
97 | # been improved and thread_local is no longer a dependency at all. |
98 | perf-cache = [] |
99 | |
100 | |
101 | # UNICODE DATA FEATURES |
102 | |
103 | # Enables all Unicode features. This expands if new Unicode features are added. |
104 | unicode = [ |
105 | "unicode-age" , |
106 | "unicode-bool" , |
107 | "unicode-case" , |
108 | "unicode-gencat" , |
109 | "unicode-perl" , |
110 | "unicode-script" , |
111 | "unicode-segment" , |
112 | "regex-automata/unicode" , |
113 | "regex-syntax/unicode" , |
114 | ] |
115 | # Enables use of the `Age` property, e.g., `\p{Age:3.0}`. |
116 | unicode-age = [ |
117 | "regex-automata/unicode-age" , |
118 | "regex-syntax/unicode-age" , |
119 | ] |
120 | # Enables use of a smattering of boolean properties, e.g., `\p{Emoji}`. |
121 | unicode-bool = [ |
122 | "regex-automata/unicode-bool" , |
123 | "regex-syntax/unicode-bool" , |
124 | ] |
125 | # Enables Unicode-aware case insensitive matching, e.g., `(?i)β`. |
126 | unicode-case = [ |
127 | "regex-automata/unicode-case" , |
128 | "regex-syntax/unicode-case" , |
129 | ] |
130 | # Enables Unicode general categories, e.g., `\p{Letter}` or `\pL`. |
131 | unicode-gencat = [ |
132 | "regex-automata/unicode-gencat" , |
133 | "regex-syntax/unicode-gencat" , |
134 | ] |
135 | # Enables Unicode-aware Perl classes corresponding to `\w`, `\s` and `\d`. |
136 | unicode-perl = [ |
137 | "regex-automata/unicode-perl" , |
138 | "regex-automata/unicode-word-boundary" , |
139 | "regex-syntax/unicode-perl" , |
140 | ] |
141 | # Enables Unicode scripts and script extensions, e.g., `\p{Greek}`. |
142 | unicode-script = [ |
143 | "regex-automata/unicode-script" , |
144 | "regex-syntax/unicode-script" , |
145 | ] |
146 | # Enables Unicode segmentation properties, e.g., `\p{gcb=Extend}`. |
147 | unicode-segment = [ |
148 | "regex-automata/unicode-segment" , |
149 | "regex-syntax/unicode-segment" , |
150 | ] |
151 | |
152 | |
153 | # UNSTABLE FEATURES (requires Rust nightly) |
154 | |
155 | # A blanket feature that governs whether unstable features are enabled or not. |
156 | # Unstable features are disabled by default, and typically rely on unstable |
157 | # features in rustc itself. |
158 | unstable = ["pattern" ] |
159 | |
160 | # Enable to use the unstable pattern traits defined in std. This is enabled |
161 | # by default if the unstable feature is enabled. |
162 | pattern = [] |
163 | |
164 | # For very fast multi-prefix literal matching. |
165 | [dependencies.aho-corasick] |
166 | version = "1.0.0" |
167 | optional = true |
168 | default-features = false |
169 | |
170 | # For skipping along search text quickly when a leading byte is known. |
171 | [dependencies.memchr] |
172 | version = "2.6.0" |
173 | optional = true |
174 | default-features = false |
175 | |
176 | # For the actual regex engines. |
177 | [dependencies.regex-automata] |
178 | path = "regex-automata" |
179 | version = "0.4.4" |
180 | default-features = false |
181 | features = ["alloc" , "syntax" , "meta" , "nfa-pikevm" ] |
182 | |
183 | # For parsing regular expressions. |
184 | [dependencies.regex-syntax] |
185 | path = "regex-syntax" |
186 | version = "0.8.2" |
187 | default-features = false |
188 | |
189 | [dev-dependencies] |
190 | # For examples. |
191 | once_cell = "1.17.1" |
192 | # For property based tests. |
193 | quickcheck = { version = "1.0.3" , default-features = false } |
194 | # To check README's example |
195 | doc-comment = "0.3" |
196 | # For easy error handling in integration tests. |
197 | anyhow = "1.0.69" |
198 | # A library for testing regex engines. |
199 | regex-test = { path = "regex-test" , version = "0.1.0" } |
200 | |
201 | [dev-dependencies.env_logger] |
202 | # Note that this is currently using an older version because of the dependency |
203 | # tree explosion that happened in 0.10. |
204 | version = "0.9.3" |
205 | default-features = false |
206 | features = ["atty" , "humantime" , "termcolor" ] |
207 | |
208 | # This test suite reads a whole boatload of tests from the top-level testdata |
209 | # directory, and then runs them against the regex crate API. |
210 | # |
211 | # regex-automata has its own version of them, and runs them against each |
212 | # internal regex engine individually. |
213 | # |
214 | # This means that if you're seeing a failure in this test suite, you should |
215 | # try running regex-automata's tests: |
216 | # |
217 | # cargo test --manifest-path regex-automata/Cargo.toml --test integration |
218 | # |
219 | # That *might* give you a more targeted test failure. i.e., "only the |
220 | # PikeVM fails this test." Which gives you a narrower place to search. If |
221 | # regex-automata's test suite passes, then the bug might be in the integration |
222 | # of the regex crate and regex-automata. But generally speaking, a failure |
223 | # in this test suite *should* mean there is a corresponding failure in |
224 | # regex-automata's test suite. |
225 | [[test]] |
226 | path = "tests/lib.rs" |
227 | name = "integration" |
228 | |
229 | [package.metadata.docs.rs] |
230 | # We want to document all features. |
231 | all-features = true |
232 | # Since this crate's feature setup is pretty complicated, it is worth opting |
233 | # into a nightly unstable option to show the features that need to be enabled |
234 | # for public API items. To do that, we set 'docsrs', and when that's enabled, |
235 | # we enable the 'doc_auto_cfg' feature. |
236 | # |
237 | # To test this locally, run: |
238 | # |
239 | # RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features |
240 | rustdoc-args = ["--cfg" , "docsrs" ] |
241 | |
242 | [profile.release] |
243 | debug = true |
244 | |
245 | [profile.bench] |
246 | debug = true |
247 | |
248 | [profile.dev] |
249 | # Running tests takes too long in debug mode, so we forcefully always build |
250 | # with optimizations. Unfortunate, but, ¯\_(ツ)_/¯. |
251 | # |
252 | # It's counter-intuitive that this needs to be set on dev *and* test, but |
253 | # it's because the tests that take a long time to run are run as integration |
254 | # tests in a separate crate. The test.opt-level setting won't apply there, so |
255 | # we need to set the opt-level across the entire build. |
256 | opt-level = 3 |
257 | debug = true |
258 | |
259 | [profile.test] |
260 | opt-level = 3 |
261 | debug = true |
262 | |