Implement Lua pattern matching for string functions
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 25/100
Direção de pesquisa
Start in the string library where findHelper hits the l.assert(false) placeholder, and locate the commented-out match, gsub and gmatch definitions beside it. The work is to port Lua's pattern matching engine so that string.find, string.match, string.gsub and string.gmatch accept patterns. Done means the %s+, (%d+) and %w+ examples in the issue return the expected results, with tests covering both plain and pattern modes.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Currently, Lua pattern matching is not implemented in the string library. This limits the functionality of several string functions to plain text operations only.
Missing Pattern Matching Support
The following functions are either missing or have incomplete pattern matching:
string.find- Only supports plain text search, pattern matching raisesTODO implement pattern matchingstring.match- Not implemented (commented out)string.gsub- Not implemented (commented out)string.gmatch- Not implemented (commented out)
Current Implementation
In findHelper, pattern matching is explicitly unimplemented:
} else {
l.assert(false) // TODO implement pattern matching
}
Use Cases
Pattern matching is essential for:
- Text processing and validation
- String transformations (gsub)
- Data extraction from structured text
- Cleaning up command output
Example of currently failing code:
-- These would fail with current implementation:
local result = str:gsub("%s+", "") -- Remove whitespace
local match = str:match("(%d+)") -- Extract numbers
local iter = str:gmatch("%w+") -- Word iterator
Impact
This limitation forces users to work around missing functionality with manual string manipulation, reducing the utility of go-lua for text processing applications.
Would it be possible to implement Lua's standard pattern matching engine for these string functions?
- Linguagem predominante
- Go
- Estrelas
- 3.5k
- Forks
- 217
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de Shopify/go-lua
-
Numeric modulo fast path disagrees with Lua 5.2 and the library fallback for negative operandsTalvez já em andamento @efegokdemir assumiu há 35 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
-
io.write discards spaces after trailing numbersTalvez já em andamento @flynn-eye assumiu há 25 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
-
State.close leaves closed upvalues in the open list, so calls get slower without boundTalvez já em andamento @efegokdemir assumiu há 17 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 25/100
-
Dificuldade 3/5 Meio dia Facilidade para iniciantes 18/100
Todas as issues de Shopify/go-lua
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
limitlessprojects/Go-Hybrid#4764 ·
Mantenedores costumam responder em até 1 dia
-
[bug]: lint fails on main, generated CLI docs out of dateTalvez já em andamento @bupd assumiu hoje. Abertabug documentation
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
goharbor/harbor-cli#1180 ·
Mantenedores costumam responder em até 1 dia
-
crane: mutate --env adds duplicate PATH on Windows images when key case differsTalvez já em andamento @aad1tyaaaaa assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
google/go-containerregistry#2523 ·
Mantenedores costumam responder em até 4 dias
-
bosh_io_stemcell_type: regular does not work for noble and resolute as it adds -go_agent as suffixAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
cloudfoundry/bosh-deployment-resource#138 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100