Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I inverse a string pattern?

For example, if:

for i in string.gmatch(str, "//")

will search for "//" in the string, how would i do the opposite so it returns every part of the string separated by "//"?

2 comments

0

Could you try -- for i in not string.gmatch(str,"//")

0

that would error

1 answer

✓ Accepted answer

you can use the //(.+) string pattern to get the characters after "//" excluding that, if thats what your looking for.

local str = "//hello world!"

for v in string.gmatch(str,"//(.+)") do
	print(v)
end

hello world!

string patterns

This discussion is preserved as it was. New answers, comments, and votes are closed.