@@ -340,12 +340,7 @@ declare namespace XRegExp {
340
340
valueNames ?: MatchRecursiveValueNames | null ;
341
341
342
342
/**
343
- * How to handle unbalanced delimiters within the subject string. Valid values are:
344
- * - 'error' - throw (default).
345
- * - 'skip' - treat unbalanced delimiters as part of the text between delimiters, and
346
- * continue searching after the unbalanced delimiter.
347
- * - 'skip-lazy' - treat unbalanced delimiters as part of the text between delimiters,
348
- * and continue searching one character after the start of the unbalanced delimiter.
343
+ * Handling mode for unbalanced delimiters.
349
344
*/
350
345
unbalanced ?: 'error' | 'skip' | 'skip-lazy' ;
351
346
}
@@ -755,31 +750,32 @@ declare namespace XRegExp {
755
750
756
751
/**
757
752
* Returns an array of match strings between outermost left and right delimiters, or an array of
758
- * objects with detailed match parts and position data. An error is thrown if delimiters are
759
- * unbalanced within the data .
753
+ * objects with detailed match parts and position data. By default, an error is thrown if
754
+ * delimiters are unbalanced within the subject string .
760
755
*
761
756
* @param str - String to search.
762
757
* @param left - Left delimiter as an XRegExp pattern.
763
758
* @param right - Right delimiter as an XRegExp pattern.
764
759
* @param flags - Any combination of XRegExp flags, used for the left and right delimiters.
765
760
* @param options - Options object with optional properties:
766
- * - `valueNames` {Array} Providing `valueNames` changes the overall return value from a
767
- * simple array of matched strings to an array of objects that provide greatly extended
768
- * information including value and position information about not only the matched strings
769
- * but also the matched delimiters and the strings outside of or between matches.
770
- * To use this extended information mode, provide 4 strings to name the parts that will be
771
- * returned: 1. values outside of (before, after, and between) matches, 2. the matched outer
772
- * left delimiter, 3. the matched text between outer left and right delimiters, and 4. the
773
- * matched outer right delimiter. Null values can be provided instead of strings for any of
774
- * these 4 parts to omit unneeded parts from the returned results.
761
+ * - `valueNames` {Array} Providing `valueNames` changes the return value from an array of
762
+ * matched strings to an array of objects that provide the value and start/end positions
763
+ * for the matched strings as well as the matched delimiters and unmatched string segments.
764
+ * To use this extended information mode, provide an array of 4 strings that name the parts
765
+ * to be returned:
766
+ * 1. String segments outside of (before, between, and after) matches.
767
+ * 2. Matched outermost left delimiters.
768
+ * 3. Matched text between the outermost left and right delimiters.
769
+ * 4. Matched outermost right delimiters.
770
+ * Taken together, these parts include the entire subject string if used with flag g.
771
+ * Use `null` for any of these values to omit unneeded parts from the returned results.
775
772
* - `escapeChar` {String} Single char used to escape delimiters within the subject string.
776
- * - `unbalanced` {String} How to handle unbalanced delimiters within the subject string.
777
- * Valid values are:
773
+ * - `unbalanced` {String} Handling mode for unbalanced delimiters. Options are:
778
774
* - 'error' - throw (default)
779
- * - 'skip' - treat unbalanced delimiters as part of the text between delimiters, and
780
- * continue searching after the unbalanced delimiter.
781
- * - 'skip-lazy' - treat unbalanced delimiters as part of the text between delimiters,
782
- * and continue searching one character after the start of the unbalanced delimiter.
775
+ * - 'skip' - unbalanced delimiters are treated as part of the text between delimiters, and
776
+ * searches continue at the end of the unbalanced delimiter.
777
+ * - 'skip-lazy' - unbalanced delimiters are treated as part of the text between delimiters,
778
+ * and searches continue one character after the start of the unbalanced delimiter.
783
779
* @returns Array of matches, or an empty array.
784
780
* @example
785
781
*
0 commit comments