I have two sentences like these:
- "How is the weather of Paris in next day"
- "How is the weather of Paris next day"
I want to extract "Paris" as the city name from both of them. I wrote this regular expression:
"How is the weather of (?P<city>[^.؟!?]*) (in next day|next day)"
This expression extracts "Paris in" for the first sentence which is not right!
I want to match an input sentence with my regular expression in a way that it will be matched with the longest alternative of the second group, so I can get the shortest city name. (I thought the order of alternative in the second group matter so I put "in next day" before "next day" but It seems that the order doesn't work!) How can I rewrite my regular expression to solve this problem?