lua-users home
lua-l archive

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


> I'm trying to access a backreference (via %1) captured in
> parenthesis, as shown below:
>
>   value = rex.gsub(value, "(?:(.{2,})%1{32,})", "x", nil, 0, 0);
>
> What is the correct syntax for accessing captured data in
> rex.gsub?

I don't think I've used this library, but both POSIX and
PCRE regexes use backslash-digit for backreferences (the
backslash is doubled below to escape its magic meaning
inside the double-quoted string literal):

  value = rex.gsub(value, "(?:(.{2,})\\1{32,})", "x", nil, 0, 0)

-- 
Aaron
http://arundelo.com/