I have been reading this post but It have not solved my problem: Regex: matching up to the first occurrence of a character
I have this variable:
$attributes = ID=CUFF.1;Name=CG12402-RB;Note=Parial_gene
I have written this script:
if ($attributes =~ /Name=([^;]*)/) {
$genename = $-[0];
$name = substr($attributes, $genename);
If I print $name
this is the output: Name=CG12402;Note=Parial_gene
But I want my output like this: Name=CG12402
Can someone help me?