This assumes a lot from your data. Mainly that the only thing possible between the commas lie in the character class [A-Za-z0-9_]use strict; use warnings; while ( <DATA> ) { s/([^"])(,\w*,\w*,ResGen,)/$1"$2/; print; } __DATA__ GENE1="Rattus norvegicus serum and glucocorticoid-regulated kinase (sg +k) mRNA, complete cds,NM_019232,333,ResGen,ATP binding|protein serine +/threonine kinase|protein amino acid phosphorylation,,,,29517 GENE2="ESTs, Weakly similar to putative serine/threonine protein kinas +e MAK-V [M.musculus]",NM_144755,331,ResGen,,,,,246273 GENE3="Thiosulfate sulphurtransferase (rhodanese)",X56228,329,ResGen,m +itochondrion|sulfate transport|thiosulfate sulfurtransferase,,,,25274 GENE4="Spleen tyrosine kinase,NM_012758,327,ResGen,ATP binding|protein + tyrosine kinase|intracellular signaling cascade|protein amino acid p +hosphorylation,,,,25155 GENE5="Spleen kinase 24,NM_012758,,ResGen,ATP binding|protein tyrosine + kinase|intracellular signaling cascade|protein amino acid phosphoryl +ation,,,,25155
-enlil
In reply to Re: Need method to create Regular expression for known pattern in the middle of a line
by Enlil
in thread Need method to create Regular expression for known pattern in the middle of a line
by Ya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |