Find keyword in multi line string and then return with the string

Heres what im trying to do:

local Color = string.find(Clan.Description, "Color")

print(Color)

Then it’d return

Colors are so cool

out of

Wowza
Colors are so cool
I love to dance

(obviously just an example)

Couldn’t you do:
string.match(your_string, "Colors are so cool")

No because the text afterwards can change

I’m confused on what you want to happen.

That was just an example more accurately its a multi line string that im gathering values from, for an example

Color:255,255,255

im gathering this from a groups description and then loading it into the game

What is the exact format for the color string

The string its receiving?

Color:255,255,255
i plan on using string.split to turn it into key, value and then value would be the color

The catch is im also gonna have other values that operate the same way so I need to gather them and the values.

You could do something like this:
string.match(your_string, "Color:%d+,%d+,%d+")

If you just wanted the number part, remove “Color:” from the pattern string.

1 Like

what does %d+ stand for? a value?

It represents a numerical digit and the + is a modifier to match one or more of the preceding character class.

1 Like

so then how would i do the same thing if it was a string?

It is for a string. It searches for numerical digit characters in a string.

1 Like

What I mean is like lets say instead of 255,255,255 it was a brickcolor like idk Bright Red

Then you would have to search for a different string pattern I suppose. That’s why I asked you what the format was. If you have multiple formats then you need multiple checks.

1 Like