Skip to content

fix: align %p behavior with native C Lua#310

Open
paq wants to merge 1 commit into
nuskey8:mainfrom
paq:align-p-matching
Open

fix: align %p behavior with native C Lua#310
paq wants to merge 1 commit into
nuskey8:mainfrom
paq:align-p-matching

Conversation

@paq
Copy link
Copy Markdown
Contributor

@paq paq commented May 11, 2026

In C Lua, when checking if a character matches %p, it uses C's ispunct function. Unlike C#'s char.IsPunctuation, ispunctalso matches characters like =. For example, in C Lua, the following expression evaluates to true:

string.gsub("abc=xyz", "(%w*)(%p)(%w+)", "%3%2%1-%0") == "xyz=abc-abc=xyz"

This PR aligns the behavior of %p with that of C Lua as described above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant