How would I get the ID from this link? (By string manipulation ofc)
https://www.roblox.com/item.aspx?seoname=Dragon-Hunter-Armor&id=134111557
What pattern is the = symbol considered?
You can use string.find and string.sub to do this. I'll explain as I go
local string = "https://www.roblox.com/item.aspx?seoname=Dragon-Hunter-Armor&id=134111557" -- Store the string local start,en = string.find(string, "id=",1, true) -- String.find returns two numbers, where the string you are trying to find starts, and where it ends, so we are storing these two values into "start", and "en". -- The parameters then go string.find(ContainingString, letters/string to find, index of where to start, true). True keeps them from being read as anything other than normal text. local id = string.sub(string, en + 1) -- We will then use substring to cut from the end of the pattern to the end of the string, since the id is last. -- Substring goes string.sub(StringToCut, StartingPosition, EndingPosition) and since we did no ending position, it will go from where it started all the way to the end by default.
If you need any other clarification, let me know.
You could use string patterns and do string.match("https://www.roblox.com/item.aspx?seoname=Dragon-Hunter-Armor&id=134111557", ".*&id=(%d+)")
.
The match function will go through the string with the string pattern and it will go through all characters being the pattern .*, at least until it gets to "&id=" then the function might actually start to care. The . indicates that the character can be any character while the * is used to match 0 or more characters, once again at least until we get to the &id= part.
Since we placed %d+ in parenthesis in the pattern, the script is keeping an eye out for digits any number between 0 and 9. %d is a character class the % telling the script to listen up, the d being for digits. Since we placed a + sign, that means the script should try to match at least 1 character that is a digit after the &id=.
There you have it, the function will return the string that was recognized so you can set it to a variable.
The ID for the item would be. 134111557
'id=134111557'