mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 01:37:39 +03:00
LibJS: Use a Utf8View on the subject if the regex has the unicode flag
This makes LibRegex behave (more) correctly with regards to matching unicode code points.
This commit is contained in:
parent
f364fcec5d
commit
c85ab623c0
Notes:
sideshowbarker
2024-07-18 08:47:23 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/c85ab623c05 Pull-request: https://github.com/SerenityOS/serenity/pull/8847 Reviewed-by: https://github.com/MaxWipfli Reviewed-by: https://github.com/linusg ✅ Reviewed-by: https://github.com/trflynn89
@ -240,7 +240,12 @@ static Value regexp_builtin_exec(GlobalObject& global_object, RegExpObject& rege
|
||||
}
|
||||
|
||||
regex.start_offset = last_index;
|
||||
result = regex.match(string);
|
||||
// FIXME: JavaScript strings are UTF-16, update this if the backing storage
|
||||
// encoding changes for spec compliance reasons.
|
||||
if (unicode)
|
||||
result = regex.match(Utf8View { string });
|
||||
else
|
||||
result = regex.match(string);
|
||||
|
||||
if (result.success)
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user