Jump to content




[Question] Help with string.match()


  • You cannot reply to this topic
7 replies to this topic

#1 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 17 August 2012 - 09:25 PM

I am looking for where I can find the string.match() inputs(?) like %d+ , %a+, and the such, and what they mean. The purpose of this is to create a calculator within CC. I need to do string separation, but I don't know how. Anyone know where I can get a library of those or an easy to follow tutorial?

#2 Grim Reaper

  • Members
  • 503 posts
  • LocationSeattle, WA

Posted 17 August 2012 - 09:30 PM

Check out this link.

Hope i helped! :(/>

#3 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 17 August 2012 - 10:00 PM

Also found(with extensive googling and CTRL+F'ing) this: http://www.lua.org/m...5.1/manual.html
Section 5.4.1 tells me exactly what I needed.

#4 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 17 August 2012 - 10:06 PM

  • x: (where x is not one of the magic characters ^$()%.[]*+-?) represents the character x itself.
  • .: (a dot) represents all characters.
  • %a: represents all letters.
  • %c: represents all control characters.
  • %d: represents all digits.
  • %l: represents all lowercase letters.
  • %p: represents all punctuation characters.
  • %s: represents all space characters.
  • %u: represents all uppercase letters.
  • %w: represents all alphanumeric characters.
  • %x: represents all hexadecimal digits.
  • %z: represents the character with representation 0.
  • %x: (where x is any non-alphanumeric character) represents the character x. This is the standard way to escape the magic characters. Any punctuation character (even the non magic) can be preceded by a '%' when used to represent itself in a pattern.
Copied straight from lua.org (it was very hard to find in amongst all the text)

#5 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 17 August 2012 - 10:12 PM

That's why I had to use CTRL + F so much... Google doesn't like searching for them...

#6 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 17 August 2012 - 10:24 PM

View Postcraniumkid22, on 17 August 2012 - 10:12 PM, said:

That's why I had to use CTRL + F so much... Google doesn't like searching for them...

You'd think they could make it easier to read with a bit of JavaScript and a rewrite or something.

#7 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 18 August 2012 - 12:27 AM

Or you can use the index, and then scroll down to where it says "String Manipulation" and click on the subitem "Patterns".

#8 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 18 August 2012 - 12:41 AM

Well, with no coding history beyond Lua in CC, I had no idea what it was I was looking for(name), but I knew what I was looking for(characters).... That sounds illogical, doesn't it?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users