Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

String Pattern Advice?

Asked by 9 years ago

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?

0
Is there a reason you can't store this in an explicit dictionary, or with JSON? BlueTaslem 18071 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

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!

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. BobserLuck 367 — 9y
0
So some names have punctuation in it, and you want it to stop at the punctuation alphawolvess 1784 — 9y
0
I probably worded the question wrong but I figured it out: Name="(.-)," Id=",(%d+)" BobserLuck 367 — 9y
Ad

Answer this question