notepad-plus-plus / notepad-plus-plus/notepad-plus-plus

[BUG] Regex replace doesn't put parenthesis '(' and ')' from the replace field. Have to escape them by '\(' and '\)'.

Open
#17,445 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
29.4k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

Is there an existing issue for this?
  • I have searched the existing issues
Is the issue reproducible in Notepad++ without plugin?
  • I have tried Notepad++ without plugin
Is the issue reproducible in portable version of Notepad++?
  • I have tried portable version of Notepad++
Does the issue affect SciTE?
  • I have tried SciTE
Description of the Issue

The parenthesis '(' and ')' in the replace field dialog are forgotten/wrongly interpreted when Search & Replace with Regex.

Steps To Reproduce
  1. New document, write some texte, eg. Nicolas qui paie = consommateur
  2. Edition > Search and Replace >
  3. Search : (con)
  4. Replace by : (\1)
  5. (Regex mode), Replace All
Current Behavior

Text after replacment :
Nicolas qui paie = consommateur

Expected Behavior

Nicolas qui paie = (con)sommateur

Debug Information
Notepad++ v8.9   (64-bit)
Build time: Dec 27 2025 - 14:28:33
Scintilla/Lexilla included: 5.5.8/5.4.6
Boost Regex included: 1_85
TinyXML-2 included: 11.0.0
nlohmann JSON included: 3.12.0
Path: C:\Program Files\Notepad++\notepad++.exe
Command Line: 
Admin mode: OFF
Local Conf mode: OFF
Cloud Config: OFF
Periodic Backup: ON
Placeholders: OFF
Scintilla Rendering Mode: SC_TECHNOLOGY_DEFAULT (0)
Multi-instance Mode: monoInst
asNotepad: OFF
File Status Auto-Detection: cdEnabledNew (for current file/tab only)
Dark Mode: OFF
Display Info:
    primary monitor: 1920x1080, scaling 100%
    visible monitors count: 1
    installed Display Class adapters: 
        0001: Description - Intel(R) HD Graphics Family
        0001: DriverVersion - 20.19.15.4624
        0002: Description - NVIDIA GeForce 820M
        0002: DriverVersion - 23.21.13.8873
OS Name: Windows 10 Pro (64-bit)
OS Version: 22H2
OS Build: 19045.6466
Current ANSI codepage: 1252
Plugins: 
    CodeAlignmentNpp (14.1.107)
    ComparePlugin (2.0.2)
    CSVLint (0.4.7)
    Explorer (1.9.9)
    LuaScript (0.12)
    mimeTools (3.1)
    NppConverter (4.7)
    NppExport (0.4)
    NppXmlTreeviewPlugin (2)
    PythonScript (2.1)
Anything else?

I suspect parenthesis '(' and ')' be interpreted by the regex.replace function but they should considered as normal characters.

Contributor guide

Open the contributing guide

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.

Research direction

No source file or test is named in the issue. Start by reproducing the Regex-mode Replace All steps in the Notepad++ search and replace dialog, then trace how the replacement field handles (\1). Done means the example changes to Nicolas qui paie = (con)sommateur without requiring escaped parentheses.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.