Quote from Phanx
tags["<His/Her>"] = "His",
tags["<his/hers>"] = "his", -- Proper sentence shouldn't start with this
for tag, word in pairs(tags) do
text = text:gsub(tag, word)
Note that only practical variations of capitalizations are included; if the user is typing in ALL-CAPS like an idiot, their tags will be ignored, and words that are not grammatically correct at the beginning of a sentence are only included in lower-case. If you don't mind the (small) performance hit, you could add more capitalization variants to accomodate user error.
This sounds like a lot more sophisticated way of doing it than what I do today.. as I already support all these tags I have four if's to go through but with your example it would be just one :)
Question is I do want the users to type what they want.. if they want to capitalize all fine for me ;) .. is it not possible at all using regexp like [aA] with this?
Quote from PhanxAlso, you don't need to specifically address the possessive he's and she's, as the user should simply type <he/she>'s.
Actually this works and has worked all the time with my current code :)