Skip to content

Incorrect handling of ^ anchor in gsub when the match succeeds, leading to multiple replacements #322

Description

@snalexp

Given the code:

s = ("firstTime"):gsub("^%l", string.upper)

Expected:
s = "FirstTime"

Actual:
s = "FIRSTTime"

It seems that the anchor only causes a break when the expression fails to match.

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