aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbutl/regex.mxx2
-rw-r--r--libbutl/regex.txx3
-rw-r--r--tests/regex/testscript7
3 files changed, 10 insertions, 2 deletions
diff --git a/libbutl/regex.mxx b/libbutl/regex.mxx
index 0d6aa70..4c21c16 100644
--- a/libbutl/regex.mxx
+++ b/libbutl/regex.mxx
@@ -44,7 +44,7 @@ LIBBUTL_MODEXPORT namespace butl
// std::regex_replace() extended the standard ECMA-262 substitution escape
// sequences with a subset of Perl sequences:
//
- // \\, \u, \l, \U, \L, \E, \1, ..., \9
+ // \\, \n, \u, \l, \U, \L, \E, \1, ..., \9
//
// Notes and limitations:
//
diff --git a/libbutl/regex.txx b/libbutl/regex.txx
index 1f87663..96b1f54 100644
--- a/libbutl/regex.txx
+++ b/libbutl/regex.txx
@@ -137,7 +137,8 @@ LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason.
switch (c)
{
- case '\\': append_chr (c); break;
+ case '\\': append_chr (c); break;
+ case 'n': append_chr ('\n'); break;
case 'u': mode = case_conv::upper_once; break;
case 'l': mode = case_conv::lower_once; break;
diff --git a/tests/regex/testscript b/tests/regex/testscript
index 5a65b4a..1d33406 100644
--- a/tests/regex/testscript
+++ b/tests/regex/testscript
@@ -34,6 +34,13 @@
$* xay a '\' >'xy' : none-term
$* xay a '\\' >'x\y' : self
+ : newline
+ :
+ $* xay a '\n' >>EOO
+ x
+ y
+ EOO
+
: capture
:
{