boost::u32regex_replace() behavior when the string has a closing newline

Open
#175 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
tooling

Research direction

Start with the provided code.txt reproduction and output.txt, then inspect boost::u32regex_replace() behavior for the input ending in a newline and the pattern ^(.*)$. Compare the observed two substitutions with the expected matching semantics; done means determining whether the result is correct and documenting or fixing the behavior accordingly.

Written by the indexing model from the issue text.

Description

It seems that boost::u32regex_replace() matches a newline with ^(.*)$ different when it is at the end of a string and not within the string.

Input: "line\nline\nline\n"
Regular expression: "^(.*)$"
Format: "Hallo\1"
Result: "Halloline\nline\nline\nHallo

Is this example intended to result in two matches and substitutions?

code.txt
output.txt

Dominant language
C++
Stars
119
Forks
113
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/regex

All issues in boostorg/regex

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.