lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>>>>> "Sai" == Sai Manoj Kumar Yadlapati <ysaimanojkumar@gmail.com> writes:

 Sai> Hi all,
 Sai> Lua supports its own version of regular expression matching.

Well, to be precise it supports a pattern-matching function that falls a
long way short of regular expressions.

 Sai> But it doesn't have the | (pipe symbol) support and the quantifier
 Sai> support - a{1,5} meaning a can occur anywhere from 1 to 5 times.

 Sai> Both of these are present in PCRE. I am curious to know why these
 Sai> are not supported.Is it not supported intentionally or was it
 Sai> never considered?

Maybe this answers your question:

% size liblua-5.3.so libpcre.so
    text   data   bss      dec       hex   filename
  236048   6457     0   242505   0x3b349   liblua-5.3.so
  483084   1237   152   484473   0x76479   libpcre.so

i.e. PCRE is nearly double the size of the entirety of Lua. (Even a
relatively minimal POSIX regexp implementation would be 2.5 times the
size of the Lua string library - ~50kB vs. ~20kB on my system.)

You can use LPEG instead (which is even more powerful than regular
expressions though has a bit of a learning curve), or if you're not
worried about size then there's a Lua binding for PCRE.

-- 
Andrew.