in reply to Regex Match : Doesn't return the longest match when there's a common word present in the group

I think you should rather solve your logic problem.

Why does one entry have an article "an" and not all of them?

Ie putting "an apple in the fridge" into your regex solves it, disallowing articles solves it too.

IOW you're comparing apples with oranges (almost literally ;) ...

edit
Of course the alternatives should be sorted by length, but you seem to know this already...

Cheers Rolf

PS: Je suis Charlie!

  • Comment on Re: Regex Match : Doesn't return the longest match when there's a common word present in the group
  • Download Code