From: "Michael W. Ryder" <_mwryder@...> Date: 2008-01-22T04:14:59+09:00 Subject: Is there an easier way to get a match before a position in a string? I am trying to find an easier way to split a string into printable lines. I could use the method of checking for a space using a loop and going back from the desired length or I could use the following: def strbrk(str, len) if str.length <= len return str.length end tmp = str[0...len].reverse x = tmp =~ / / if x == nil return -1 else return len - x end end I could not find any way to get a regexp to search from the end of the string which would have eliminated the need to reverse the string.