regex-partial-match 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -82,6 +82,7 @@ Such combinations have not been tested.
82
82
  - ⚓ [Input Boundaries](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Input_boundary_assertion) (`^`, `$`)
83
83
  - 🆒 [Word Boundaries](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Word_boundary_assertion) (`\b`, `\B`)
84
84
  - 🏴 [Flags](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/flags): `g`, `i`, `m`, `s`, `u`, `d`, `y` (See [caveats](#sticky-flag-y) for `y`)
85
+ - 🎚️ [Modifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Modifier) (`(?ims:...)`, `(?-ims:...)`, `(?im-s:...)`)
85
86
 
86
87
  ## Unsupported Features
87
88
 
@@ -89,7 +90,6 @@ The following regex features are **not currently supported**:
89
90
 
90
91
  - ⚠️ [Backreferences](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Backreference) (`\1`, `\k<name>`) - Can be included, but can't partially match. See [caveats](#caveats).
91
92
  - ⚠️ [Character class substrings](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Character_class#matching_strings) (`\q{abc}`) - When used independently, rather than to modify, can be included, but can't partially match. See [caveats](#caveats).
92
- - ❌ [Modifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Modifier) (`(?ims:...)`, `(?-ims:...)`) - ES2025+. See [issue](https://github.com/TomStrepsil/regex-partial-match/issues/2).
93
93
 
94
94
  ## Browser Compatibility
95
95
 
@@ -102,6 +102,7 @@ The library is compiled to **ES5** for broad compatibility with older browsers a
102
102
  - [**`s` (dotAll) flag**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/dotAll) - ES2018+
103
103
  - [**`d` (hasIndices) flag**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/hasIndices) - ES2022+
104
104
  - [**`v` (unicodeSets) flag**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicodeSets) - ES2024+
105
+ - [**Modifiers**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Modifier) (`(?ims:...)`, `(?-ims:...)`, `(?i-ms:...)`) - ES2025+
105
106
 
106
107
  ## Caveats
107
108
 
package/lib/index.js CHANGED
@@ -102,21 +102,30 @@ var createPartialMatchRegex = function (regex) {
102
102
  i += 3;
103
103
  result += process() + ")";
104
104
  break;
105
+ case "-":
106
+ case "i":
107
+ case "s":
108
+ case "m":
109
+ var temp = i + 2, temp2 = source.indexOf(":", temp);
110
+ result += "(?" + source.substring(temp, temp2) + ":";
111
+ i = temp2 + 1;
112
+ result += process() + ")";
113
+ break;
105
114
  case "!": {
106
- var temp = i;
115
+ var temp_1 = i;
107
116
  i += 3;
108
117
  process();
109
- result += source.substring(temp, i);
118
+ result += source.substring(temp_1, i);
110
119
  break;
111
120
  }
112
121
  case "<":
113
122
  switch (source[i + 3]) {
114
123
  case "=":
115
124
  case "!": {
116
- var temp = i;
125
+ var temp_2 = i;
117
126
  i += 4;
118
127
  process();
119
- result += source.substring(temp, i);
128
+ result += source.substring(temp_2, i);
120
129
  break;
121
130
  }
122
131
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "regex-partial-match",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "A regular expression transform for partial matching",
5
5
  "devEngines": {
6
6
  "runtime": {