#! /usr/bin/perl my $string = qq~BS -202 -135 R00929; HS$IFNB_14. BS -167 -94 R00916; HS$IFNB_01; Binding factors: R2 T00712. BS -100 -61 R00917; HS$IFNB_02; Binding factors: IRF1 T00422, IRF-2 BS T00425.>.~; my @infos = $string =~ /]+>([RT][0-9]+)<\/a>/ig; print $_,"\n" for(@infos);