lua-users home
lua-l archive

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


to make re.anywhere more convenient, i added = prefix in re.lua for anywhere search
this produce very readable lpeg re pattern

t = 'this and that and whatever'

-- search for end position of that
= re.match(t, "= 'that'")
14

-- search for start and end of 'that'
= re.match(t, "=({} 'that' {})")
10      14

-- lua pattern ".*and(.*)"
= re.match(t, "(= 'and')+ {.*}")
 whatever