From: Burke Libbey Date: 2007-08-11T00:28:38+09:00 Subject: Creating a over a range while preserving nesting While this is a rails-related question, it has more to do with ruby in general. The user selects a range by highlighting it. This is detected with javascript and fed to ruby. I want to take this range and highlight it. I'm doing that by adding around the region. So that works ok, except that this often causes tag nesting problems. What I want to do is intelligently add more tag pairs to preserve nesting. For example, the range: this is a test that uses pretty bizarre markup. Should become: this is a test that uses pretty bizarre markup. I'm not looking for someone to write the code for me (although if you did, I wouldn't complain); I just need someone to point me in the right direction. Should I start from scratch with RegExes, or is there a suitable library? Thanks. /burke -- Posted via http://www.ruby-forum.com/.