Skip to content

replace enhancements #26

Open
Open
@timotheecour

Description

@timotheecour
  • detect errors at CT instead of RT if both regex pattern and replace pattern are given at CT
    eg:
    echo "abcfoodef".replace(re"f(o)o", "[$2]") should give a CT error

  • error in replacement pattern should be more useful instead of just invalidFormatString ; in above example could show:
    error in replace pattern "[$2]" at column 2: out of bound error 2: expected values 1 through 1

  • $0 could be supported with meaning of "whole match"

  • other patterns could be used for before match and after match, as in https://dlang.org/phobos/std_regex.html#Replace%20format%20string ; either using D's

$` | part of input preceding the match.
-- | --
$' | part of input following the match.

or perhaps using more explicit / easier to remember names, eg $(pre) $(post)

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