I’m writing a network related program in linux. the program is in kernel space and not user space.
All I need in this program is a regular expression library that supports all gnu regex library features plus non-greedy repeat.
Is there any such library that has those features and also I can compile and use it in kernel space?
Advertisement
Answer
I would recommend TRE. Be aware that it has a number of bugs in its POSIX BRE support (just misparsing/misinterpreting the meaning of certain characters as BRE), but the POSIX ERE support is very good, and it has most (all?) GNU extensions as well as non-greedy matching support. Only other thing I would warn you about is that there’s at least one dangerous bug in the parser if you’ll be processing regular expressions from untrusted sources. If you’re only using your own regular expressions, this shouldn’t matter.