Skip to content

clarify the matching pat in replacement documentation #1983

@nyurik

Description

@nyurik

String manipulation contains this section which is not very clear. Does pat refer to an exact string match, e.g. removing trim_end_match("foobar", "bar") would result in "foo", or does it support some pattern matching (as the variable name would imply)? I tried it with regex, but it seems like it is not working.

trim_end_match(s, pat) - Remove suffix of s matching pat.
trim_end_matches(s, pat) - Repeatedly remove suffixes of s matching pat.
trim_start_match(s, pat) - Remove prefix of s matching pat.
trim_start_matches(s, pat) - Repeatedly remove prefixes of s matching pat.

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