Skip to content

The pattern “(?<=aa)b” works, while “(?<=a{2})b” does not #360

Description

@Viorel

It seems that (?<=a{2})b is not accepted:

// Using CTRE 3.11.0,
// Visual Studio 2026, Console Application, C++20

#include "single-header\\ctre-unicode.hpp"

int main( )
{
	auto matches = ctre::search_all<L"(?<=a{2})b">( L"aab" );

	for( const auto& match : matches )
	{

	}

	return 0;
}

The errors are located in ctre-unicode.hpp:

  • 'first': no matching overloaded function found
  • 'collides': no matching overloaded function found
  • binary '=': no operator found which takes a right-hand operand of type 'Iterator' (or there is no acceptable conversion)

If the pattern is replaced with a similar one — (?<=aa)b — then it works.

It is expected to work in both cases.

There is also an on-line sample for different compilers: https://godbolt.org/z/frTKGx4c8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions