README.md in regexp-examples-1.3.1 vs README.md in regexp-examples-1.3.2
- old
+ new
@@ -13,11 +13,11 @@
\* If the regex has an infinite number of possible srings that match it, such as `/a*b+c{2,}/`,
or a huge number of possible matches, such as `/.\w/`, then only a subset of these will be listed.
For more detail on this, see [configuration options](#configuration-options).
-If you'd like to understand how/why this gem works, please check out my [blog post](http://tom-lord.weebly.com/blog/reverse-engineering-regular-expressions) about it.
+If you'd like to understand how/why this gem works, please check out my [blog post](https://tom-lord.github.io/Reverse-Engineering-Regular-Expressions/) about it.
## Usage
#### Regexp#examples
@@ -98,16 +98,18 @@
* Character sets, e.g. `/[abc]/` - including:
* Ranges, e.g.`/[A-Z0-9]/`
* Negation, e.g. `/[^a-z]/`
* Escaped characters, e.g. `/[\w\s\b]/`
* POSIX bracket expressions, e.g. `/[[:alnum:]]/`, `/[[:^space:]]/`
+ * ...Taking the current ruby version into account - e.g. the definition of `/[[:punct:]]/`
+ [changed](https://bugs.ruby-lang.org/issues/12577) in version `2.4.0`.
* Set intersection, e.g. `/[[a-h]&&[f-z]]/`
* Escaped characters, e.g. `/\n/`, `/\w/`, `/\D/` (and so on...)
* Capture groups, e.g. `/(group)/`
* Including named groups, e.g. `/(?<name>group)/`
* And backreferences(!!!), e.g. `/(this|that) \1/` `/(?<name>foo) \k<name>/`
- * ...even for the more "obscure" syntax, e.g. `/(?<future>the) \k'future'/`, `/(a)(b) \k<-1>/``
+ * ...even for the more "obscure" syntax, e.g. `/(?<future>the) \k'future'/`, `/(a)(b) \k<-1>/`
* ...and even if nested or optional, e.g. `/(even(this(works?))) \1 \2 \3/`, `/what about (this)? \1/`
* Non-capture groups, e.g. `/(?:foo)/`
* Comment groups, e.g. `/foo(?#comment)bar/`
* Control characters, e.g. `/\ca/`, `/\cZ/`, `/\C-9/`
* Escape sequences, e.g. `/\x42/`, `/\x5word/`, `/#{"\x80".force\_encoding("ASCII-8BIT")}/`
@@ -176,27 +178,24 @@
## Bugs and TODOs
There are no known major bugs with this library. However, there are a few obscure issues that you *may* encounter:
* Conditional capture groups, e.g. `/(group1)? (?(1)yes|no)/.examples` are not yet supported. (This example *should* return: `["group1 yes", " no"]`)
-* `\Z` should be interpreted like `\n?\z`; it's currently just interpreted like `\z`. (This basically just means you'll be missing a few examples.)
-* Ideally, `regexp#examples` should always return up to `max_results_limit`. Currenty, it usually "aborts" before this limit is reached.
- (I.e. the exact number of examples generated can be hard to predict, for complex patterns.)
-* There are some (rare) edge cases where backreferences do not work properly, e.g. `/(a*)a* \1/.examples` -
- which includes `"aaaa aa"`. This is because each repeater is not context-aware, so the "greediness" logic is flawed.
- (E.g. in this case, the second `a*` should always evaluate to an empty string, because the previous `a*` was greedy.)
- However, patterns like this are highly unusual...
* Nested repeat operators are incorrectly parsed, e.g. `/b{2}{3}/` - which *should* be interpreted like `/b{6}/`. (However, there is probably no reason
to ever write regexes like this!)
+* A new ["absent operator" (`/(?~exp)/`)](https://medium.com/rubyinside/the-new-absent-operator-in-ruby-s-regular-expressions-7c3ef6cd0b99)
+ was added to Ruby version `2.4.1`. This gem does not yet support it (or gracefully fail when used).
+* Ideally, `regexp#examples` should always return up to `max_results_limit`. Currenty, it usually "aborts" before this limit is reached.
+ (I.e. the exact number of examples generated can be hard to predict, for complex patterns.)
Some of the most obscure regexp features are not even mentioned in [the ruby docs](http://ruby-doc.org/core/Regexp.html).
However, full documentation on all the intricate obscurities in the ruby (version 2.x) regexp parser can be found
[here](https://raw.githubusercontent.com/k-takata/Onigmo/master/doc/RE).
## Impossible features ("illegal syntax")
The following features in the regex language can never be properly implemented into this gem because, put simply, they are not technically "regular"!
-If you'd like to understand this in more detail, check out what I had to say in [my blog post](http://tom-lord.weebly.com/blog/reverse-engineering-regular-expressions) about this gem.
+If you'd like to understand this in more detail, check out what I had to say in [my blog post](https://tom-lord.github.io/Reverse-Engineering-Regular-Expressions/) about this gem.
Using any of the following will raise a `RegexpExamples::IllegalSyntax` exception:
* Lookarounds, e.g. `/foo(?=bar)/`, `/foo(?!bar)/`, `/(?<=foo)bar/`, `/(?<!foo)bar/`
* [Anchors](http://ruby-doc.org/core/Regexp.html#class-Regexp-label-Anchors) (`\b`, `\B`, `\G`, `^`, `\A`, `$`, `\z`, `\Z`), e.g. `/\bword\b/`, `/line1\n^line2/`