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

String Pattern Advice?

I'm having a bit of trouble with string patterns. I have a list of songs and their Id's like so: list={"Name, ID#", ...}

I have a matching pattern that will separate the name and the ID so they can be used separately: name="[%s%a]+" Id="%d+"

This works fine except when there is a punctuation mark of some kind or number in the name. I know this is a simple problem but I'm still having a bit of trouble with string patterns. Is there a way to gather all characters up until the "," and then all the numbers after it?

1 comment

0

Is there a reason you can't store this in an explicit dictionary, or with JSON?

1 answer

I don't use String Patterns, but I believe you may be looking for %p which is any punctuation character.

Don't forget to use the wiki!

3 comments

0

Yeah, I have that page open already XD I just don't know how to get all characters up to the "," and then everything after it.

0

So some names have punctuation in it, and you want it to stop at the punctuation

0

I probably worded the question wrong but I figured it out: Name="(.-)," Id=",(%d+)"

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