mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibJS: Don't escape backslashes in RegExp.source
The spec doesn't require this, and no one else does so.
This commit is contained in:
parent
82470e9266
commit
5dce916a50
Notes:
sideshowbarker
2024-07-17 00:25:23 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/5dce916a50 Pull-request: https://github.com/SerenityOS/serenity/pull/17480 Issue: https://github.com/SerenityOS/serenity/issues/17433
1 changed files with 1 additions and 1 deletions
|
@ -249,7 +249,7 @@ DeprecatedString RegExpObject::escape_regexp_pattern() const
|
|||
if (m_pattern.is_empty())
|
||||
return "(?:)";
|
||||
// FIXME: Check the 'u' and 'v' flags and escape accordingly
|
||||
return m_pattern.replace("\n"sv, "\\n"sv, ReplaceMode::All).replace("\r"sv, "\\r"sv, ReplaceMode::All).replace(LINE_SEPARATOR_STRING, "\\u2028"sv, ReplaceMode::All).replace(PARAGRAPH_SEPARATOR_STRING, "\\u2029"sv, ReplaceMode::All).replace("/"sv, "\\/"sv, ReplaceMode::All);
|
||||
return m_pattern.replace("\n"sv, "\\n"sv, ReplaceMode::All).replace("\r"sv, "\\r"sv, ReplaceMode::All).replace(LINE_SEPARATOR_STRING, "\\u2028"sv, ReplaceMode::All).replace(PARAGRAPH_SEPARATOR_STRING, "\\u2029"sv, ReplaceMode::All);
|
||||
}
|
||||
|
||||
// 22.2.3.2.4 RegExpCreate ( P, F ), https://tc39.es/ecma262/#sec-regexpcreate
|
||||
|
|
Loading…
Add table
Reference in a new issue