Regular expressions in C: examples?

后端 未结 5 1146
傲寒
傲寒 2020-11-22 04:57

I\'m after some simple examples and best practices of how to use regular expressions in ANSI C. man regex.h does not provide that much help.

5条回答
  •  甜味超标
    2020-11-22 05:19

    It's probably not what you want, but a tool like re2c can compile POSIX(-ish) regular expressions to ANSI C. It's written as a replacement for lex, but this approach allows you to sacrifice flexibility and legibility for the last bit of speed, if you really need it.

提交回复
热议问题