@ptolemy2002/rgx 12.2.0 → 12.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/dist/constants.d.ts +5 -0
- package/dist/constants.js +10 -1
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -120,6 +120,11 @@ export declare const RGX_PREDEFINED_CONSTANTS: {
|
|
|
120
120
|
readonly rgxGroupWrap: false;
|
|
121
121
|
readonly toRgx: () => RegExp;
|
|
122
122
|
};
|
|
123
|
+
readonly "escape-bound": {
|
|
124
|
+
readonly rgxGroupWrap: false;
|
|
125
|
+
readonly rgxIsRepeatable: false;
|
|
126
|
+
readonly toRgx: () => RegExp;
|
|
127
|
+
};
|
|
123
128
|
readonly "non-escape-bound": {
|
|
124
129
|
readonly rgxGroupWrap: false;
|
|
125
130
|
readonly rgxIsRepeatable: false;
|
package/dist/constants.js
CHANGED
|
@@ -144,12 +144,21 @@ exports.RGX_PREDEFINED_CONSTANTS = {
|
|
|
144
144
|
toRgx() { return /[\b]/; }
|
|
145
145
|
},
|
|
146
146
|
// Complex Constructs
|
|
147
|
+
"escape-bound": {
|
|
148
|
+
rgxGroupWrap: false,
|
|
149
|
+
rgxIsRepeatable: false,
|
|
150
|
+
toRgx() {
|
|
151
|
+
// Put this before any pattern to ensure that the pattern is escaped, i.e., preceded by an odd number of backslashes.
|
|
152
|
+
return /(?<=(?<!\\)\\(?:\\\\)*)/;
|
|
153
|
+
}
|
|
154
|
+
},
|
|
147
155
|
"non-escape-bound": {
|
|
148
156
|
rgxGroupWrap: false,
|
|
149
157
|
rgxIsRepeatable: false,
|
|
150
158
|
toRgx() {
|
|
151
159
|
// Put this before any pattern to ensure that the pattern is not escaped, i.e., not preceded by an odd number of backslashes.
|
|
152
|
-
|
|
160
|
+
// Essentially equivalent to escape-bound, but without the extra backslash between the negative lookbehind and the non-capturing group.
|
|
161
|
+
return /(?<=(?<!\\)(?:\\\\)*)/;
|
|
153
162
|
}
|
|
154
163
|
},
|
|
155
164
|
};
|