Non-Greedy Regular Expression Matching in Flex

前端 未结 2 1269
旧巷少年郎
旧巷少年郎 2020-12-19 08:16

I have just started with Flex and can\'t seem to figure out how to match the following Expression :

\"Dog\".*\"Cat\"
------------------
Input :
Dog Ca Cat Cc         


        
2条回答
  •  攒了一身酷
    2020-12-19 08:55

    A good question. Here is a pure regex solution, without using the non-greedy .*? syntax:

    Dog([^C]|C+(aC+)*([^Ca]|a[^Ct]))*C+(aC+)*at

提交回复
热议问题