请教github上1道编程题的题意# JobHunting - 待字闺中
M*A
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。
万分感谢。
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。
万分感谢。