As the title says... Chat on...

User avatar
By Rijpaard
#21411 In the snippet below:
Code: Select allprint("request=["..request.."]")
 _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP");
  print("method=", "["..method.."]")
  print("path=", "["..path.."]")
  print("vars=", "["..vars.."]")

request= [GET / HTTP/1.1]
and the results are:
method= nil
path= nil
vars= nil

Why is method nil. I can't figure out why it is not "GET"
The first capure is ([A-Z]+) so according the rules of pattern-matching it should be "GET".

Please enlighten me !
User avatar
By cal
#21607 Moin,

please notice that
Lua does not use POSIX regular expressions (regexp) for pattern matching
.

http://www.lua.org/pil/20.1.html

Cal
Last edited by cal on Thu Jun 25, 2015 11:49 am, edited 1 time in total.
User avatar
By TerryE
#21626 My link below points you to the necessary references.