String handling
Lua's string
library supports a lot of handy string operations. Strings will obviously be used frequently when writing NSE scripts because they represent byte sequences. Let's review the most common functions for string handling.
Character classes
Character classes are special operators used in patterns. We need them when matching or subtracting substrings, so keep them in mind when we review patterns and string operations. Character classes are as follows:
Magic characters
The following characters have special functions within patterns:
Patterns
Patterns are used to match strings, and they are very powerful. Think about them as simplified regular expressions in Lua. Character classes and captures are used in combination with patterns to allow programmers to perform advanced matching and string substitution and extraction...