https://github.com/yuin/gluare
A regular expression library for the GopherLua
https://github.com/yuin/gluare
Last synced: 9 months ago
JSON representation
A regular expression library for the GopherLua
- Host: GitHub
- URL: https://github.com/yuin/gluare
- Owner: yuin
- License: mit
- Created: 2015-10-03T09:50:36.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-10-21T23:30:57.000Z (about 3 years ago)
- Last Synced: 2025-03-25T16:21:13.724Z (10 months ago)
- Language: Go
- Size: 5.86 KB
- Stars: 12
- Watchers: 2
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
===============================================================================
gluare: Regular expressions for the GopherLua
===============================================================================
.. image:: https://travis-ci.org/yuin/gluare.svg
:target: https://travis-ci.org/yuin/gluare
|
gluare is a regular expression library for the `GopherLua `_ .
gluare has almost the same API as Lua pattern match.
.. contents::
:depth: 1
----------------------------------------------------------------
Installation
----------------------------------------------------------------
.. code-block:: bash
go get github.com/yuin/gluare
----------------------------------------------------------------
Usage
----------------------------------------------------------------
.. code-block:: go
import (
"github.com/yuin/gopher-lua"
"github.com/yuin/gluare"
)
L := lua.NewState()
defer L.Close()
L.PreloadModule("re", gluare.Loader)
----------------------------------------------------------------
Lua functions
----------------------------------------------------------------
`re.find` , `re.gsub`, `re.match`, `re.gmatch` are available. These functions have the same API as Lua pattern match. gluare uses the Go regexp package, so you can use regular expressions that are supported in the Go regexp package.
In addition, the following functions are defined:
**gluare.quote(s string) -> string**
Arguments:
=========================== ==============================================
s string a string value to escape meta characters
=========================== ==============================================
Returns:
=========================== ==============================================
string escaped string
=========================== ==============================================
gluare.quote returns a string that quotes all regular expression metacharacters inside the given text.