Skip to content

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

@mmtsuchi-fr

Description

@mmtsuchi-fr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions