由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 请教github上1道编程题的题意
相关主题
求教一道经典面题的解法求字符串最后一个单词的长度
[面试题] 如何打印一个二叉树level by level?求解一道题 思路也好
[面试题]unix如何<<一行>>命令给一个文本文件末尾加几个字符paste command 里面的 -
问道 facebook 面试题C++ string to int Problem
an interview question问计算机词汇的翻译 -- flush
问一道matching的算法题目,谢谢!!C++ Q13: Input
fb面试题【转】C++ Q20: construction and inheritance
readLine和balanceParanthesis的code谁写了?帮看看这个C++里trim last blanks,错在哪里?
相关话题的讨论汇总
话题: program话题: 题意话题: 字符串话题: 64257话题: expression
进入JobHunting版参与讨论
1 (共1页)
M**A
发帖数: 78
1
请教各位朋友, 下面github上1道编程题的题意。
Write a program in C/C++ that translates a pattern specification
provided as ancommand line argument into a regular expression, processes
lines of input text receivedfrom stdin using that regular expression to
qualify matches, and finally writes eachmatching input line to stdout.
Each line of input is terminated by the newline character'n', and the
program should terminate when it receives EOF.The program should be
executable as follows:$ cat input.txt | program "is this message %{0}
ballpark %{1S3}" > output.txtThe program should be structured to parse the
pattern specification and generated aregular expression which
expresses the pattern. The program should then use thelibpcre library (www.
pcre.org) available on linux and Windows systems, to executematches to
qualify each line of text received on stdin.
https://github.com/dmi3s/ptfilter/blob/master/README
这道题需要实现将1个文本文件input.txt逐行扫描,把含有特定字符串的行读到output
.txt。
如果是写1个函数来实现特定字符串的匹配,应该可以办到。
不过好像题意是,要调用 http://www.pcre.org/ 中的libpcre library的函数来实现特定字符串的匹配, 而不是自己写1个函数来实现特定字符串的匹配。
可是 The PCRE library is a set of functions that implement regular
expression pattern matching using the same syntax and semantics as Perl 5.
请教各位朋友,是不是需要建立C/C++ call Perl 的API。
万分感谢。
s***e
发帖数: 403
2
C++有自己的regex库。libpcre可以用LoadLibrary(win)或者dl_open(linux)打开。
1 (共1页)
进入JobHunting版参与讨论
相关主题
帮看看这个C++里trim last blanks,错在哪里?fb面试题【转】
ASIO异步一问readLine和balanceParanthesis的code谁写了?
求教一道经典面题的解法求字符串最后一个单词的长度
[面试题] 如何打印一个二叉树level by level?求解一道题 思路也好
[面试题]unix如何<<一行>>命令给一个文本文件末尾加几个字符paste command 里面的 -
问道 facebook 面试题C++ string to int Problem
an interview question问计算机词汇的翻译 -- flush
问一道matching的算法题目,谢谢!!C++ Q13: Input
相关话题的讨论汇总
话题: program话题: 题意话题: 字符串话题: 64257话题: expression