generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Help?

Previous Thread :: Next Thread 
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
20 Jul 2013 04:24 PM
What does the string pattern "+" do? (Zars, after looking at wiki. I was wrong about it..)
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
20 Jul 2013 04:26 PM
It matches 1 or more of the characters specified.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
20 Jul 2013 04:27 PM
Yeah, i wouldn't have come here if i didn't look up on wiki.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
20 Jul 2013 04:29 PM
Meaning, I must have another explonation then that...
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
20 Jul 2013 04:46 PM
bump
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
20 Jul 2013 06:25 PM
bump
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
20 Jul 2013 06:30 PM
+ matches one or more characters.

local String = "ABC123DEF456"

print(String:match("%a")) --> A
print(String:match("%a+")) -->ABC
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
21 Jul 2013 07:07 AM
So...We always need the + pattern in a pattern? like if we wanted a full match?
Report Abuse
magnificentpurple13 is not online. magnificentpurple13
Joined: 26 Apr 2013
Total Posts: 399
21 Jul 2013 07:25 AM
[ Content Deleted ]
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
21 Jul 2013 07:29 AM
Stop spamming.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
21 Jul 2013 07:39 AM
I'm still abit unsure
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
21 Jul 2013 08:47 AM
bump
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
21 Jul 2013 09:27 AM
bump
Report Abuse
magnificentpurple13 is not online. magnificentpurple13
Joined: 26 Apr 2013
Total Posts: 399
21 Jul 2013 09:29 AM
[ Content Deleted ]
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
21 Jul 2013 09:32 AM
Wow idiot, bump.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
21 Jul 2013 09:48 AM
bump
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
21 Jul 2013 09:50 AM
⚽⚾🎾🎱🏉🏈🏀🎳...wait, what?

Anyway, yes. If you want a full match, use +. If you don't, do not.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
21 Jul 2013 09:50 AM
Oh ok, thanks.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
10 Aug 2013 01:38 PM
Yes, i'm bumping this so i don't need to ask on a new thread. Anyway, why does it only get the first match without the + pattern? like why does it happen without it?

Also, i have gotten the + pattern like this:

When i do a string pattern for some reason it only returns the first character match.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
10 Aug 2013 01:39 PM
Did you enclose it with ( and )?
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
10 Aug 2013 01:39 PM
Take an example:

(%w+)
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
10 Aug 2013 03:34 PM
Yes but according to you, and that other guy

local String = "ABC123DEF456"

print(String:match("%a")) --> A
print(String:match("%a+")) -->ABC

When i have a pattern, it only returns the first character match if i don't use the + pattern???
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
10 Aug 2013 03:54 PM
for k in String:gmatch("(%a+)") do
print(k)
end
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
10 Aug 2013 04:10 PM
Okay, %a is any letter. So it gets the first letter from the string.

print(("abc123def"):match("%a"))
>a
print(("abc123def"):match("%a+"))
>abc

+ returns all the letters(whatever you used) that are contiguous.

print(("abc1 123 def"):match("%w"))
>a
print(("abc1 123 def"):match("%w+"))
>abc1

for match in ("abc1 123 def"):match("%w") do
print(match)
end
>a, b, c, 1, 1, 2, 3, d, e, f

for match in ("abc1 123 def"):match("%w+") do
print(match)
end
>abc1, 123, def
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
10 Aug 2013 04:27 PM
I'm still at where i started. Why won't it give a full match without the +?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image