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

Does :match() work when the string has no spaces?

I'm trying to find a word in a string but the string is all 1 word

local Name = 'HelloWelcomeToThisWorld'
print( (Name:match('ToThis') ) 

does this work?

2 answers

This would work, as it is still inside the string, even if it is inside a word. The only thing that is wrong is that you added an extra parentheses, so your fixed code should be

local Name = 'HelloWelcomeToThisWorld'
print((Name:match('ToThis')) 

Hope this helps!

That won't work, because with that, you're only setting one word, called 'HelloWelcomeToThisWorld'. There might be any method to bypass that, but with the scripting you have there, that won't work definitely.

If you found this answer helpful, please mark as the solution!

2 comments

0

What? What do you mean by only setting one string?

0

i mistaken the word, sorry. You're only setting one word with the thing you pasted there up.

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