String captures with string.gsub

well yea this is my fault, I am wrong
though I looked and I guess you can remove string patterns using the fourth argument

the fourth argument is a boolean and is false by default, making it true removes string pattern support
well I guess I learned something, sorry again btw

oh yea you are right, I wasn’t even thinking about that

function ConvertPlural(String)
    local Start, Middle, Last = string.match(String, "(.+)(%a)(%a)%s*$")

    return string.match(Last, "[yY]?") and (string.find("aAeEiIoOuU", Middle) and String.."s" or Start..Middle.."ies") or String.."s"
end

print(ConvertPlural("Pony"))
print(ConvertPlural("Pooy"))
print(ConvertPlural("Pon"))

made a function that should work well enough

1 Like