File: README.rst

package info (click to toggle)
golang-github-yuin-gluare 0.0~git20170607.d7c94f1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 84 kB
  • sloc: makefile: 3
file content (62 lines) | stat: -rw-r--r-- 2,056 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
===============================================================================
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 <https://github.com/yuin/gopher-lua>`_ .
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.