We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e2813da commit 250d73dCopy full SHA for 250d73d
lib/jsonschema.lua
@@ -40,17 +40,24 @@ do
40
end
41
42
local match_pattern
43
+local rex_find
44
if ngx then
45
local function re_find(s, p)
46
return ngx.re.find(s, p, "jo")
47
48
match_pattern = re_find
49
else
- local ok, rex = pcall(require, "rex_pcre")
50
- if not ok then
51
- error("depends on lrexlib-pcre, please install it first: " .. rex)
+ match_pattern = function (s, p)
+ if not rex_find then
52
+ local ok, rex = pcall(require, "rex_pcre")
53
+ if not ok then
54
+ error("depends on lrexlib-pcre, please install it first: " .. rex)
55
+ end
56
+
57
+ rex_find = rex.find
58
59
+ return rex_find(s, p)
60
- match_pattern = rex.find
61
62
63
local parse_ipv4
0 commit comments