This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Cyclonit's profile picture

Ignore "^[" when looking for "["

Started by Cyclonit, 20 July 2012 - 11:32 AM
Cyclonit #1
Posted 20 July 2012 - 01:32 PM
Hi,

is it possible to make this code:
str = string.gsub(str, "[", "^[[")

Not touch any occurrence of "^["? There should be some kind of regex expression I think, but I never got around understanding how those work…

Cyclonit
1lann #2
Posted 20 July 2012 - 03:53 PM
Hi,

is it possible to make this code:
str = string.gsub(str, "[", "^[[")

Not touch any occurrence of "^["? There should be some kind of regex expression I think, but I never got around understanding how those work…

Cyclonit
the regex for [ is %[. So try %^%[%[