• Announcement: Lua.org now officially recommends this forum as a meeting place for the Lua community

Need help tweaking a regexp to accept only *.c files (1 Viewer)

awsdert

Newcomer
Joined
Apr 7, 2022
Messages
11
Reaction score
0
This is where I'm at:
Code:
for _,prj in ipairs(projects) do
    cfg[prj] =
    {
        src_files = allsubents
        (
            {
                ignore = function(ud)
                    if ud.mode == "directory" then
                        return false
                    end
                    local found = string.match(ud.name,".*\\.c$")
                    return (not found or #found == 0)
                end
            }, "src/" .. prj
        ).ents
    }
    configure
    (
        "cfg." .. prj .. ".src_files", ":=",
        joinstrings( nil, cfg[prj].src_files ), info
    )
end
Thought I had it right but get no output and yes I have checked allsubents() works correctly, used it for to identify all cfg.mak files (since that's just a simple string comparison on the name alone was easy to get right), and yes I've also checked I get the right projects listed (that one uses a variant of allsubents, allsubdirs), it's just the regexp that's messing up the output
 

awsdert

Newcomer
Joined
Apr 7, 2022
Messages
11
Reaction score
0
Never mind, finally found the info I needed, just needed to replace the \\ with another . to escape the .
 
Top