Skip to content

Document the syntax for output capture groups #390

@DannyStoll1

Description

@DannyStoll1

The pattern syntax of sad differs from that sed in that $ is used instead of \ in the output pattern to reference capture groups. For instance,

sed 's/pre_(\w*)_suf/\1'

is analogous to

sad 'pre_(\w*)_suf' '$1'

This feature is unfortunately not very discoverable at the moment (I had to resort to trial and error). Perhaps it could be added to the help for replace? E.g.

  /// Replacement pattern, empty = delete, $<group_no> for regex captures
  #[clap()]
  pub replace: Option<String>,

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