Skip to content
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

Quantifiers. Complete support for ranges: ++?? {2, 4}; ##?? {2} or {4}; ... #7

Merged
merged 4 commits into from
Aug 9, 2020

Conversation

3F
Copy link
Owner

@3F 3F commented Aug 8, 2020

Since we have only this today (++ after 86f0be1):

regex regXwild n
.* * 0+
.+ + 1+
.? ? 0; 1
.{1} # 1
.{2} ## 2
.{2, } ++ 2+
.{0, 2} ?? 0 - 2 -> {0, n}

and similar.

This PR will finally add complete support for (n, m) ranges 👇

✔ ++?? And d2fb0b6

{n, m} where n > 0 and m > n

n == +
m == ?

  • ++?? (2 - 4)
  • +??? (1 - 4)
  • +++? (3 - 4)
  • +? (1 - 2)

✔ ##?? Or a421443

{n, m} where n > 0 and m > n

n == #
m == ?

  • ##?? (2 | 4)
  • #??? (1 | 4)
  • ###? (3 | 4)
  • #? (1 | 2)

* `++??` (2 - 4)
* `+???` (1 - 4)
* `+++?` (3 - 4)
* `+?`   (1 - 2)

etc.
@3F 3F added the enhancement label Aug 8, 2020
@3F 3F added this to the 1.3 milestone Aug 8, 2020
3F added 2 commits August 9, 2020 19:56
* `##??` (2 | 4)
* `#???` (1 | 4)
* `###?` (3 | 4)
* `#?`   (1 | 2)

etc.

See tests.

Part of #7
@3F
Copy link
Owner Author

3F commented Aug 9, 2020

regex regXwild n
.* * 0+
.+ + 1+
.? ? 0; 1
.{1} # 1
.{2} ## 2
.{2, } ++ 2+
.{0, 2} ?? 0 - 2
.{2, 4} ++?? 2 - 4
(?:.{2}|.{4}) ##?? 2; 4
.{3, 4} +++? 3 - 4
(?:.{1}|.{3}) #?? 1; 3

@3F 3F changed the title WIP. Quantifiers. Complete support for ranges: ++?? {2, 4}; ##?? {2} or {4}; ... Quantifiers. Complete support for ranges: ++?? {2, 4}; ##?? {2} or {4}; ... Aug 9, 2020
@3F 3F merged commit db6ec8b into master Aug 9, 2020
@3F 3F deleted the dev/quantifiers/ranges branch August 9, 2020 17:55
3F added a commit that referenced this pull request Aug 10, 2020
* NEW: Quantifiers are now standardized as follows:
        https://github.com/3F/regXwild#-quantifiers

        regex           | regXwild   | n
        ----------------|------------|---------
        .\*             | \*         | 0+
        .+              | +          | 1+
        .?              | ?          | 0;  1
        .{1}            | #          | 1
        .{2}            | ##         | 2
        .{2, }          | ++         | 2+
        .{0, 2}         | ??         | 0 - 2
        .{2, 4}         | ++??       | 2 - 4
        (?:.{2}\|.{4})  | ##??       | 2;  4
        .{3, 4}         | +++?       | 3 - 4
        (?:.{1}\|.{3})  | #??        | 1;  3

* NEW: Second-order Quantifiers. Added support for `++`
        regex equivalent `.{n, }`

* NEW: Quantifiers. Implemented `++??` support for ranges. Part of PR #7.
        ```
        {n, m} where n > 0 and m > n

            n == +
            m == ?
        ```
        * `++??` (2 - 4)
        * `+???` (1 - 4)
        * `+++?` (3 - 4)
        * `+?`   (1 - 2)

        etc. See unit-tests.

* NEW: Quantifiers. Implemented `##??` support for ranges. Part of PR #7.
        ```
        {n, m} where n > 0 and m > n

            n == #
            m == ?
        ```
        * `##??` (2 | 4)
        * `#???` (1 | 4)
        * `###?` (3 | 4)
        * `#?`   (1 | 2)

        etc. See unit-tests.

* FIXED: Fixed rewind in MS-split `|` like for '##'|'####'

* FIXED: Fixed errors in second order quantifiers: `?? == .{0, 2}` and `## == .{2}`
         For example:
         * False positive matching `[1####_of` for `TV_[11_of_24]`
         * Crashed `number = '????';` for `number = '123';`
         * and related.

* CHANGED: API versionString() marked as obsolete due to RXWVersion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant