> #{ (0..(BASE_SOLEXA + cutoff)).map {|ch| > Regexp.escape(ch.chr)}.join("|") } > > This gives shorter and more readable strings. OK, so for the right range that is equal to: regex = Regexp.union((-5 .. cutoff).collect { |n| (n + BASE_SOLEXA).chr } ) Which returns: (?-mix:;|<|=|>|\?|@|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T) But I dont get how the substitution will scan one string (scores) an make changes to the other (seq): seq = 'TTGGTCGCTCGCTCCGCGACCTCAGATCAGACGTGGGCGAT' scores = '@ABCDEFGHIJK?MNOPQRSTUVWhgfedcba`_^]\[ZYX' ? > AFAIK there are none. That is actually strange. In Perl you can do this: perl -le 'print "ABCDEFG" | " \0\0 "' => abCDefg Which I believe is very efficient. And the mask with " " and "\0" can be constructed with transliterate efficiently too. Cheers, Martin -- Posted via http://www.ruby-forum.com/.