Documentation
¶
Overview ¶
Package regexp implements golang package regexp functionality for lua.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindAllStringSubmatch ¶
regexp_ud:find_all_string_submatch(string) returns table of table of strings
Example ¶
regexp_ud:find_all_string_submatch(string)
state := lua.NewState() Preload(state) inspect.Preload(state) source := ` local regexp = require("regexp") local inspect = require("inspect") local reg, err = regexp.compile("string: '(.*)\\s+(.*)'$") if err then error(err) end local result = reg:find_all_string_submatch("string: 'hello world'") print(inspect(result, {newline="", indent=""})) ` if err := state.DoString(source); err != nil { log.Fatal(err.Error()) }
Output: { { "string: 'hello world'", "hello", "world" } }
func Match ¶
regexp_ud:match(string) returns bool
Example ¶
regexp_ud:match(string)
state := lua.NewState() Preload(state) source := ` local regexp = require("regexp") local reg, err = regexp.compile("hello") if err then error(err) end local result = reg:match("string: 'hello world'") print(result) ` if err := state.DoString(source); err != nil { log.Fatal(err.Error()) }
Output: true
func Preload ¶
Preload adds regexp to the given Lua state's package.preload table. After it has been preloaded, it can be loaded using require:
local regexp = require("regexp")
func SimpleFindAllStringSubmatch ¶
regexp.find_all_string_submatch(regular expression string, string) returns (table of table strings, error)
func SimpleMatch ¶
regexp.match(regular expression string, string) returns (bool, error)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.