How do I write a simple regular expression pattern matching function in C or C++?

后端 未结 9 956
我寻月下人不归
我寻月下人不归 2021-02-01 06:58

This is a question in my paper test today, the function signature is

int is_match(char* pattern,char* string)

The pattern is limited to only A

9条回答
  •  悲&欢浪女
    2021-02-01 07:43

    try to make a list of interesting test cases:

    is_match("dummy","dummy") should return true;

    is_match("dumm?y","dummy") should return true;

    is_match("dum?y","dummy") should return false;

    is_match("dum*y","dummy") should return true;

    and so on ...

    then see how to make the easier test pass, then the next one ...

提交回复
热议问题