← 返回 bloomberg 的题目列表Simplified Grep Implementation
类型:online_judge
Write a simplified version of the grep program that can search for lines containing a specific string within a file. Consider the extensibility of the program to support different flags in the future. Ensure the code is clean and maintainable. The program takes input as a file path and a search string, and outputs the matching lines.
Input Description:
A string representing the file path;
A search string.
Output Description:
Lines containing the search string, separated by newline characters.
Note:
Case insensitivity is not required.
You don't need to implement actual file reading, assume the input is provided through other means.
The code should support future function extensions.
Example
Input
test_input = "First line
Second line with match
Third line"