title: Ruby Regex non-greedy match: looking for the closest occurrence of a phrase left to a searched word
body: <p>Lets say I have the following string: <code>"BENffew123X\r\nBENx432f456X\r\nBEN!233789X\r\nBEN4545789X"</code>
  I want to have a regex that will catch "BEN!233789", it has to lookup non-greedily for "BEN", followed by any character (excluding the word "BEN") and ending with 789X. I tried the regex: <code>/BEN.+?789X/mi</code>and I get <code>"BENffew123X\r\nBENx432f456X\r\nBEN!233789X"</code> as a match.
  I understand that this regex looks for the first "BEN" and catches the start of the string, but I want it to look for the "BEN" which is closest to the first "789X". How can I achieve that? One Idea is to reverse the string, should I do it?</p>