【发布时间】:2010-03-01 23:12:32
【问题描述】:
谁能给我完整的示例程序,如何在 gcc C 或 C++ (http://docs.freebsd.org/info/regex/regex.info.GNU_Regex_Functions.html) 中使用 GNU 正则表达式函数,
re_pattern_buffer, re_compile_fastmap?
例如,翻译这个 Python 小程序:
import re
unlucky = re.compile('1\d*?3')
nums = ("13", "31", "777", "10003")
for n in nums:
if unlucky.search(n) is None:
print "lucky"
else:
print "unlucky"
谢谢!
【问题讨论】:
-
您应该尝试自己翻译。如果您在使用它时遇到问题,请随时发布具体问题。