ngx.re split bug

29 views
Skip to first unread message

ms2008

unread,
Dec 27, 2017, 1:21:48 AM12/27/17
to openresty-en

snippet

./resty -e '
     local ngx_re = require "ngx.re"

     local raw_list = {
         "1\x1fT\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f15",
         "1\x1fT\x1fT\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f15",
         "1\x1fT\x1fT\x1fT\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f15"
     }

     for _,v in ipairs(raw_list) do
         local col_list = ngx_re.split(v, "\\x1F")
         print(#col_list, "\t", table.concat(col_list, "|"))
     end
'

openresty/1.13.6.1

9    1|T|||||||15
9    1|T|T||||||15
10    1|T|T|T||||||15

openresty/1.11.2.4

15    1|T|||||||||||||15
15    1|T|T||||||||||||15
15    1|T|T|T|||||||||||15
Reply all
Reply to author
Forward
0 new messages