0Pricing
Lua Academy · Lesson

Lua Pattern Syntax

Learn character classes %d, %a, %s, anchors, and quantifiers in Lua patterns.

Lua Patterns vs Regex

Lua uses its own pattern language, not full POSIX regex. It is simpler and faster, but lacks alternation (|) and lookaheads.

Character Classes

%d digit, %a letter, %l lowercase, %u uppercase, %s whitespace, %p punctuation, %w alphanumeric. Uppercase negates: %D = non-digit.

All lessons in this course

  1. Lua Pattern Syntax
  2. Captures and string.match
  3. string.gmatch for Tokenization
  4. string.gsub for Transformations
← Back to Lua Academy