Skip to content

Added start/end of string, "hex", modifiers #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

tom-lord
Copy link
Contributor

@tom-lord tom-lord commented Jun 8, 2014

0.1.5 --> 0.1.6:

  • Added "hex" ([a-fA-F0-9]), "start_of_string" (\A), "end_of_string" (\z).
  • Changed the way start/end of line are implemented slightly, as I think they were wrong/bug-prone. (See the related issue I raised.)
    This make version 0.1.6 slightly incompatible with the previous, but the change (which only affects weird uses of start/end_of_line, and some uses for alternatively) is unlikely to even be noticed.

0.1.6 --> 0.2.0

  • Added modifiers. I.e. ignorecase and multiline. These can be passed in as parameters with the VerEx constructor, e.g. VerEx.new(:ignorecase) do ......
    This is also a slight bug fix, since VerEx.new was creating case insensitive regular expressions by default. From the ruby docs:

    If options is a Fixnum, it should be one or more of the constants Regexp::EXTENDED,
    Regexp::IGNORECASE, and Regexp::MULTILINE, or-ed together. Otherwise, if options is not nil or false,
    the regexp will be case insensitive
    .

Previously, modifiers was being defaulted to an empty string, not nil or false.

0.2.0 --> 0.2.1

  • Added :whole_line and :whole_string arguments which the VerEx can be initialised with. This is effectively just a shorthand for writing start/end_of_line/string in the VerEx block.

P.s. I didn't want to re-generate the gemspec myself as I'm submitting this on a Windows machine which has all different versions of things installed.

tom-lord added 9 commits June 7, 2014 20:38
Why can't a regex have more than one start/end of line? They can now.

Also, using "alternatively" broke when combined with end_of_line due to
an implementation bug. Not anymore!
Often, people use ^ and $, when actually they would be better with \A
and \z
Avoided use of "\h" as this feature was added for ruby 1.9 (i.e. it's
not in <=1.8.7), and currently everything else should work in 1.8.7.
Forgot to use DOUBLE quotes for "\n"
This is also a slight BUG FIX, since regexes were being produced as case
insensitive by default!
0.2.0 as this is a significant new feature, and could genuinely cause
slight backwards compatibility issues because of the bug fix.
This reverts commit e6bfa87.
(oops.)
@tom-lord tom-lord changed the title Added support for start/end of string, and "hex" Added start/end of string, "hex", modifiers Jun 10, 2014
tom-lord added 3 commits June 10, 2014 22:35
Modifiers are now implemented, as of version 0.2.0
This was inspired by the 'original' JavaScript version's feature:
searchOneLine().
The :whole_line modifier can potentially be violated if, for example,
the user includes "\n" in the search pattern - but there's not much can
be done about that!
0.2.0 --> 0.2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant