Skip to content

Releases: tom-lord/regexp-examples

POSIX group support

22 Feb 23:31
Compare
Choose a tag to compare

Examples can now be generated for POSIX groups (including negated groups), e.g.

/[[:alpha:]]/.examples

Also a significant code refactor, laying the foundations for the needed Chargroup parser refactor

Escaped octal characters supported

22 Feb 15:43
Compare
Choose a tag to compare

The following now works:

/\10/.examples # => ["\x08"]

And if you do have 10+ backreferences in the pattern, then these will correctly take precedence over the octal character interpretation.

Better escaped character support

10 Feb 11:01
Compare
Choose a tag to compare

You can now include \G at the start of the pattern,
or \X in the pattern,
or \K (anywhere, because it's basically just ignored!) in the pattern,
or \R in the pattern.

(Note: Some of this stuff isn't even mentioned on ruby-doc.org!!)

These missing features were picked up due to adding a more rigorous (complete) list of tests.

Also a couple of odd bug fixes.

Option toggling

08 Feb 21:50
Compare
Choose a tag to compare

Option toggling within the pattern is now fully supported. For example:

/ab(?i)c/.examples #=> ["abc", "abC"]
/a(?-i:bc)/i.examples #=> ["abc", "Abc"]

Also added support for comment groups, such as /foo(?#comment)bar/.examples

Full options suppport

08 Feb 13:47
Compare
Choose a tag to compare

Multiline and extended options now supported. Both of the following now work:

/./m.examples(max_group_results: 999)

/
line 1 # comment
line 2
/x.examples

Ignorecase now supported

04 Feb 21:44
Compare
Choose a tag to compare

For example:

/cool/i.examples # => ["cool", "cooL", "coOl", "coOL", ...]

Previously, the ignorecase flag was just.... ignored.

Full modifiers and backreference support

03 Feb 21:53
Compare
Choose a tag to compare

Fixed various important edge cases, like non-greedy operator, and some backreference scenarios.
For example, all of the following not work, which did not in the previous version:

/a++/.examples
/a{1}?/.examples
/([ab]){2} \1/.examples

Non-greedy quantifiers

02 Feb 14:39
Compare
Choose a tag to compare

Non-greedy quantifiers are not regular, and will not always work - i.e. when using them in combination with certain capture groups and back-references.

However, they are now at least implemented with a warning message.

Configuration options added

25 Jan 11:46
Compare
Choose a tag to compare

Added new feature: Config options max_repeater_variance and max_group_results. For full details, refer to README.

Various bug fixes... Most significantly: ALL valid examples are now being returned, e.g. /[ab]{2}/.examples now includes "ab" and "ba", whereas before it did not.

Number of examples improved

24 Jan 17:17
Compare
Choose a tag to compare

The main (noticable) change is that the number of examples generated for repeaters is better defined:

.* is equivalent to .{0,2}
.+ is equivalent to .{1,3}
.{2,} is equivalent to .{2,4}
.{,3} is equivalent to .{0,2}
.{3,8} is equivalent to .{3,5}

There are also various bug fixes, such as:

  • Empty character sets, e.g. /[^\w\W]/.examples (Previously returned ["-"]; now [])
  • Mixing OrGroups and backreferences, e.g. /(a|b)\1/.examples (Previously didn't work properly, at all)