Need advice on checking if text is written in quotes

I need a way to check if a sentence is written in quotes inside a string and if so then it wont replace the word with something else.

Any help is appreciated.

if string.find(String, "\"") then

This will search for a quotation character in a string. Please share an example if that isn’t what you meant.

2 Likes

String Patterns

I would suggest using the %bxy pattern

The balanced capture matching x , y , and everything between (for example, %b() matches a pair of parentheses and everything between them)

for quotes you would use a pattern like so:

local capture = string.match(TEXTHERE, '%b""')
1 Like

No but I need a way to check if its in quotes.