On 09.04.2007 15:28, Nanyang Zhan wrote: > what kind of pattern will match the part of sentence before a <span> > tag? > > for instance: > for this sentence: > This forum is connected to a mailing list that is read by <span > class="wow">thousands</span> of people. > > it'll match: > This forum is connected to a mailing list that is read by One way to do it: irb(main):022:0* s='This forum is connected to a mailing list that is read by <span irb(main):023:0' class="wow">thousands</span> of people.' => "This forum is connected to a mailing list that is read by <span\nclass=\"wow\">thousands</span> of people." irb(main):024:0> s[/\A(.*?)<span/, 1] => "This forum is connected to a mailing list that is read by " robert