README.md in regexp-examples-0.3.1 vs README.md in regexp-examples-0.3.2

- old
+ new

@@ -12,26 +12,23 @@ ## Usage ```ruby /a*/.examples #=> [''. 'a', 'aa'] -/b+/.examples #=> ['b', 'bb'] +/ab+/.examples #=> ['ab', 'abb', 'abbb'] /this|is|awesome/.examples #=> ['this', 'is', 'awesome'] -/foo-.{1,}-bar/.examples #=> ['foo-a-bar', 'foo-b-bar', 'foo-c-bar', 'foo-d-bar', 'foo-e-bar', - # 'foo-aa-bar', 'foo-bb-bar', 'foo-cc-bar', 'foo-dd-bar', 'foo-ee-bar', 'foo-aaa-bar', 'foo-bbb-bar', - # 'foo-ccc-bar', 'foo-ddd-bar', 'foo-eee-bar'] /https?:\/\/(www\.)?github\.com/.examples #=> ['http://github.com', # 'http://www.github.com', 'https://github.com', 'https://www.github.com'] /(I(N(C(E(P(T(I(O(N)))))))))*/.examples #=> ["", "INCEPTION", "INCEPTIONINCEPTION"] /\x74\x68\x69\x73/.examples #=> ["this"] /\u6829/.examples #=> ["цай"] /what about (backreferences\?) \1/.examples #=> ['what about backreferences? backreferences?'] ``` ## Supported syntax -* All forms of repeaters (quantifiers), e.g. `/a*/`, `/a+/`, `/a?/`, `/a{1,4}/`, `/a{3,}/`, `a{,2}` +* All forms of repeaters (quantifiers), e.g. `/a*/`, `/a+/`, `/a?/`, `/a{1,4}/`, `/a{3,}/`, `/a{,2}/` * Boolean "Or" groups, e.g. `/a|b|c/` * Character sets (inluding ranges and negation!), e.g. `/[abc]/`, `/[A-Z0-9]/`, `/[^a-z]/`, `/[\w\s\b]/` * Escaped characters, e.g. `/\n/`, `/\w/`, `/\D/` (and so on...) * Non-capture groups, e.g. `/(?:foo)/` * Capture groups, e.g. `/(group)/` @@ -63,9 +60,19 @@ * Lookarounds, e.g. `/foo(?=bar)/`, `/foo(?!bar)/`, `/(?<=foo)bar/`, `/(?<!foo)bar/` * [Anchors](http://ruby-doc.org/core-2.2.0/Regexp.html#class-Regexp-label-Anchors) (`\b`, `\B`, `\G`, `^`, `\A`, `$`, `\z`, `\Z`), e.g. `/\bword\b/`, `/line1\n^line2/` * However, a special case has been made to allow `^` and `\A` at the start of a pattern; and to allow `$`, `\z` and `\Z` at the end of pattern. In such cases, the characters are effectively just ignored. (Note: Backreferences are not really "regular" either, but I got these to work with a bit of hackery!) + +## Known Bugs + +There are a few obscure bugs that have yet to be resolved: + +* Various (weird!) legal patterns do not get parsed correctly, such as `/[[wtf]]/.examples` - To solve this, I'll probably have to dig deep into the Ruby source code and imitate the actual Regex parser more closely. + +* Not all examples are shown for repeated groups, e.g. `/[ab]{2}/.examples` does not contain `"ab"` or `"ba"`. This is due to a flaw in the current parser design, and will be fixed in the next major release. + +* Similarly, examples like `/(a){2} \1/.examples #=> ["aa aa"]` do not quite work properly, as the backreference is saved as `"aa"`, rather than just `"a"`. This bug is closely related to the one above. ## Installation Add this line to your application's Gemfile: