Lua’s string library supports a lot of handy string operations. Strings will obviously be used frequently when writing NSE scripts because they represent a byte sequences. Let’s review the most common functions for string handling.
String handling
Character classes
Character classes are special operators used in patterns. We will need them when matching or subtracting substrings, so keep them in mind while we review patterns and string operations. Character classes are as follows:
. |
All characters |
%a |
Letters |
%c |
Control characters |
%d |
Digits |
%l |
Lower case letters |
%p |
Punctuation characters |
%s |
Space characters |
%u |
Upper case letters |
%w |
Alphanumeric characters |
%x |
Hexadecimal digits |
... |