|
| 1 | +0.2.0 |
| 2 | +===== |
| 3 | +This is a new major release of the regex crate, and is an implementation of the |
| 4 | +[regex 1.0 RFC](https://github.com/rust-lang/rfcs/blob/master/text/1620-regex-1.0.md). |
| 5 | +We are releasing a `0.2` first, and if there are no major problems, we will |
| 6 | +release a `1.0` shortly. For `0.2`, the minimum *supported* Rust version is |
| 7 | +1.12. |
| 8 | + |
| 9 | +There are a number of **breaking changes** in `0.2`. They are split into two |
| 10 | +types. The first type correspond to breaking changes in regular expression |
| 11 | +syntax. The second type correspond to breaking changes in the API. |
| 12 | + |
| 13 | +Breaking changes for regex syntax: |
| 14 | + |
| 15 | +* POSIX character classes now require double bracketing. Previously, the regex |
| 16 | + `[:upper:]` would parse as the `upper` POSIX character class. Now it parses |
| 17 | + as the character class containing the characters `:upper:`. The fix to this |
| 18 | + change is to use `[[:upper:]]` instead. Note that variants like |
| 19 | + `[[:upper:][:blank:]]` continue to work. |
| 20 | +* The character `[` must always be escaped inside a character class. |
| 21 | +* The characters `&`, `-` and `~` must be escaped if any one of them are |
| 22 | + repeated consecutively. For example, `[&]`, `[\&]`, `[\&\&]`, `[&-&]` are all |
| 23 | + equivalent while `[&&]` is illegal. (The motivation for this and the prior |
| 24 | + change is to provide a backwards compatible path for adding character class |
| 25 | + set notation.) |
| 26 | +* A `bytes::Regex` now has Unicode mode enabled by default (like the main |
| 27 | + `Regex` type). This means regexes compiled with `bytes::Regex::new` that |
| 28 | + don't have the Unicode flag set should add `(?-u)` to recover the original |
| 29 | + behavior. |
| 30 | + |
| 31 | +Breaking changes for the regex API: |
| 32 | + |
| 33 | +* `find` and `find_iter` now **return `Match` values instead of |
| 34 | + `(usize, usize)`.** `Match` values have `start` and `end` methods, which |
| 35 | + return the match offsets. `Match` values also have an `as_str` method, |
| 36 | + which returns the text of the match itself. |
| 37 | +* The `Captures` type now only provides a single iterator over all capturing |
| 38 | + matches, which should replace uses of `iter` and `iter_pos`. Uses of |
| 39 | + `iter_named` should use the `capture_names` method on `Regex`. |
| 40 | +* The `replace` methods now return `Cow` values. The `Cow::Borrowed` variant |
| 41 | + is returned when no replacements are made. |
| 42 | +* The `Replacer` trait has been completely overhauled. This should only |
| 43 | + impact clients that implement this trait explicitly. Standard uses of |
| 44 | + the `replace` methods should continue to work unchanged. |
| 45 | +* The `quote` free function has been renamed to `escape`. |
| 46 | +* The `Regex::with_size_limit` method has been removed. It is replaced by |
| 47 | + `RegexBuilder::size_limit`. |
| 48 | +* The `RegexBuilder` type has switched from owned `self` method receivers to |
| 49 | + `&mut self` method receivers. Most uses will continue to work unchanged, but |
| 50 | + some code may require naming an intermediate variable to hold the builder. |
| 51 | +* The free `is_match` function has been removed. It is replaced by compiling |
| 52 | + a `Regex` and calling its `is_match` method. |
| 53 | +* The `PartialEq` and `Eq` impls on `Regex` have been dropped. If you relied |
| 54 | + on these impls, the fix is to define a wrapper type around `Regex`, impl |
| 55 | + `Deref` on it and provide the necessary impls. |
| 56 | +* The `is_empty` method on `Captures` has been removed. This always returns |
| 57 | + `false`, so its use is superfluous. |
| 58 | +* The `Syntax` variant of the `Error` type now contains a string instead of |
| 59 | + a `regex_syntax::Error`. If you were examining syntax errors more closely, |
| 60 | + you'll need to explicitly use the `regex_syntax` crate to re-parse the regex. |
| 61 | +* The `InvalidSet` variant of the `Error` type has been removed since it is |
| 62 | + no longer used. |
| 63 | +* Most of the iterator types have been renamed to match conventions. If you |
| 64 | + were using these iterator types explicitly, please consult the documentation |
| 65 | + for its new name. For example, `RegexSplits` has been renamed to `Split`. |
| 66 | + |
| 67 | +A number of bugs have been fixed: |
| 68 | + |
| 69 | +* [BUG #151](https://github.com/rust-lang/regex/issues/151): |
| 70 | + The `Replacer` trait has been changed to permit the caller to control |
| 71 | + allocation. |
| 72 | +* [BUG #165](https://github.com/rust-lang/regex/issues/165): |
| 73 | + Remove the free `is_match` function. |
| 74 | +* [BUG #166](https://github.com/rust-lang/regex/issues/166): |
| 75 | + Expose more knobs (available in `0.1`) and remove `with_size_limit`. |
| 76 | +* [BUG #168](https://github.com/rust-lang/regex/issues/168): |
| 77 | + Iterators produced by `Captures` now have the correct lifetime parameters. |
| 78 | +* [BUG #175](https://github.com/rust-lang/regex/issues/175): |
| 79 | + Fix a corner case in the parsing of POSIX character classes. |
| 80 | +* [BUG #178](https://github.com/rust-lang/regex/issues/178): |
| 81 | + Drop the `PartialEq` and `Eq` impls on `Regex`. |
| 82 | +* [BUG #179](https://github.com/rust-lang/regex/issues/179): |
| 83 | + Remove `is_empty` from `Captures` since it always returns false. |
| 84 | +* [BUG #276](https://github.com/rust-lang/regex/issues/276): |
| 85 | + Position of named capture can now be retrieved from a `Captures`. |
| 86 | +* [BUG #296](https://github.com/rust-lang/regex/issues/296): |
| 87 | + Remove winapi/kernel32-sys dependency on UNIX. |
| 88 | +* [BUG #307](https://github.com/rust-lang/regex/issues/307): |
| 89 | + Fix error on emscripten. |
| 90 | + |
| 91 | + |
1 | 92 | 0.1.80
|
2 | 93 | ======
|
3 | 94 | * [PR #292](https://github.com/rust-lang-nursery/regex/pull/292):
|
|
0 commit comments