I have written a fairly lengthy discussion about:
This can be found at: http://www.gammon.com.au/mushclient/LPEG.htm
There is also a shortcut at: http://www.gammon.com.au/lpeg
That pages compares and contrasts the various techniques you can use to parse strings and extract data from them. This is useful in situations like parsing incoming text from the MUD, or in some cases fiddling with incoming packets to do things like extract or alter colour coding.
- PCRE regular expressions (such as are used in triggers)
- Lua patterns (as used in Lua string.find and string.match)
- LPEG grammars (which can be used in Lua)
This can be found at: http://www.gammon.com.au/mushclient/LPEG.htm
There is also a shortcut at: http://www.gammon.com.au/lpeg
That pages compares and contrasts the various techniques you can use to parse strings and extract data from them. This is useful in situations like parsing incoming text from the MUD, or in some cases fiddling with incoming packets to do things like extract or alter colour coding.