Skip to content

improve documentation for replacement group syntax #2108

@Antiever

Description

@Antiever

What version of ripgrep are you using?

ripgrep 13.0.0

How did you install ripgrep?

Github binary release

What operating system are you using ripgrep on?

Windows 10 Pro 21H2

Describe your bug.

Replace group strange behavior if not separated from text

What are the steps to reproduce the behavior?

>echo link="https:\\site.com" | rg "(.*)(https.*?)(\")" -or "$1localhost$3"
>"

however

>echo link="https:\\site.com" | rg "(.*)(https.*?)(\")" -or "$1 localhost$3"
>link=" localhost"

Workaround for now is changing regex to insert "" between $1 and text

What is the expected behavior?

>echo link="https:\\site.com" | rg "(.*)(https.*?)(\")" -or "$1localhost$3"
>link="localhost"

Metadata

Metadata

Assignees

No one assigned

    Labels

    docAn issue with or an improvement to documentation.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions