Detect Words [ HOW ]

Is there a way to detect words between two quotation marks, so I want let’s say on the textbox it says “Hello, World!” , it will print Hello, World!
But they have to be between two quotation marks, can’t be just like “Hello, World! or Hello, World!”, must be “Hello, World!”

I would guess that you could use:

string.match()

I would recomend looking at this: String Patterns (roblox.com)

1 Like

Like what @Escape_Everything says, you should use string.match with a pattern. Specifically, %bxy:

local text = [[print("Hello World!")]]
local piece = text:match("%b\"\"")

piece = piece:sub(2, #piece - 1) -- Remove the quotation marks

print(piece) -- Expected output: Hello World!
1 Like

Why there’s \ ? May I know? Char…

\ in a string simply escapes the succeeding character(s). Do note that certain characters have special meanings, such as \n producing a newline and \t producing a horizontal tab. See String.String Escapes