How to see if something is in between two speech marks?

Hi, I have a text box. And in the text box, I want to see if the user writes “Hello world” including the speech marks. Then I want to use gsub and replace “Hello world” with <font color=".."'".."#ff4faa".."'"..">".."Hell world".."</font> How would I do this?

When the user does write “Hello world” I want the text to turn into this:
image

To see if they wrote “Hello world!” including the speech marks, I would do something like this:

-- Using single quotes to allow checking for double quotes
if string.find(message, '"Hello world!"') ~= nil then
    -- Code
end

Yes, that makes sense, but how would I find ANY word(s) with speech marks around it and then replace them using gsub?

Ah, I see. In that case, we’d need to involve a little string manipulation:

local quoteWordsFound = {} -- Store what's found here
local quoteWordLocation = 0

-- Checks for quoted words and if so, returns them, otherwise nil
local function checkNextQuoteWord(message)
	local quoteWord = nil
	-- Search for the 1st quote
	local quote1 = string.find(message, '"')
	if quote1 ~= nil then
		-- Search for the 2nd quote, but after the 1st one
		local quote2 = string.find(message, '"', quote1 + 1)
		if quote2 then
			quoteWordLocation = quote1 -- Store where it was found
			quoteWord = string.sub(message, quote1, quote2)
		end
	end
	return quoteWord -- If nil, none was found
end

local text = '"Hello""Howareyou?"   "Good"' -- Example

local nextQuoteWord = checkNextQuoteWord(text)
while (nextQuoteWord ~= nil) do
	-- Store all quote words found
	table.insert(quoteWordsFound, nextQuoteWord)

	-- Cut out the original piece of the message
	text = string.sub(text, #nextQuoteWord + quoteWordLocation)
	nextQuoteWord = checkNextQuoteWord(text)
end

-- Below outputs "Hello", "Howareyou?" and "Good"
for _, quoteWord in pairs(quoteWordsFound) do
	print(quoteWord)
end

You could then loop through all the words found in quoteWordsFound and do a gsub for each of them.