From a2b9c2bd7810ab30907b14a7857c4491e3dcc837 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Thu, 21 Oct 2021 06:14:49 +0300 Subject: [PATCH] Document Regex constructor using "u" flag in JS #KT-46694 --- libraries/stdlib/js/src/kotlin/text/regex.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/stdlib/js/src/kotlin/text/regex.kt b/libraries/stdlib/js/src/kotlin/text/regex.kt index 5771d67e914..c2f63b79320 100644 --- a/libraries/stdlib/js/src/kotlin/text/regex.kt +++ b/libraries/stdlib/js/src/kotlin/text/regex.kt @@ -38,6 +38,10 @@ public actual data class MatchGroup(actual val value: String) * For pattern syntax reference see [MDN RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Special_characters_meaning_in_regular_expressions) * and [http://www.w3schools.com/jsref/jsref_obj_regexp.asp](https://www.w3schools.com/jsref/jsref_obj_regexp.asp). * + * Note that `RegExp` objects under the hood are constructed with [the "u" flag](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicode) + * that enables Unicode-related features in regular expressions. This also makes the pattern syntax more strict, + * for example, prohibiting unnecessary escape sequences. + * * @constructor Creates a regular expression from the specified [pattern] string and the specified set of [options]. */ public actual class Regex actual constructor(pattern: String, options: Set) {