regex in string matching scripts

Post Reply
Lucky24
Posts: 52
Joined: Sun Sep 12, 2010 1:50 am

regex in string matching scripts

Post by Lucky24 »

The built-in lua string library uses its own proprietary pattern matching code, for which I can't seem to find an OR (aka "|") regex equivalent.

I would like a more elegant solution, such as regex support in scripts themselves, or a way to have an OR operator for string matches. Any suggestions?

EDIT: By regex I mean PCRE or POSIX regular expressions. It seems the Programming in Lua book refers to the pattern matching of the string standard library as regular expressions, but it's quite limited (by design for speediness).
Last edited by Lucky24 on Tue Mar 29, 2011 4:52 am, edited 1 time in total.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: regex in string matching scripts

Post by Vadi »

Um, no, it doesn't use proprietary matching code.

Regex support in scripts themselves is already included: http://rrthomas.github.com/lrexlib/manual.html#match

Lucky24
Posts: 52
Joined: Sun Sep 12, 2010 1:50 am

Re: regex in string matching scripts

Post by Lucky24 »

Thanks! The programming in Lua book doesn't have any reference to this library, and a google search doesn't bring it up. Thanks.

And I should have quantified regular expressions as PCRE or POSIX.

Post Reply