Skip to content

[libc++] <regex>: Optional empty repetitions should not match #133314

Open
@Alcaro

Description

@Alcaro
> /(a?)+/.exec("aaa")
Array [ "aaa", "a" ]
> /((b)?(be)?)+bbee/.exec("bbebbee")
Array(4) [ "bbebbee", "bbe", "b", "be" ]

~Firefox

But in libc++, the equivalent operations return [ "aaa", "" ] and [ "bbebbee", "", undefined, undefined ].

Full example: https://godbolt.org/z/zYYenvEdb (blatantly modified from microsoft/STL#5365)

Bug also exists in libstdc++ and ms-stl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120212
microsoft/STL#5490

Metadata

Metadata

Assignees

No one assigned

    Labels

    libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.regexIssues related to regex

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions