Hi all,
from this string, (champs1 (champs6 donnee_o donnee_f) [(champs2 [] (champs3 _YOJNJeyyyyyyB (champs4 donnee_x)) (debut 144825 25345) (fin 244102 40647)), (champs2 [] (champs3 _FuGNJeyyyyyyB (champs4 donnee_z)) (debut 796443 190570) (fin 145247 42663))] [] []).
, i would like to extract the first number after the word "debut", and the first number after the word "fin". I write this:
while (my $readfile = <FILE>) #read each line and check the first value X1 after the word "coorDeb" and the first value X2 after the word "coorFin"
{
my ($line) = $_;
chomp ($line);
($first, $second)= ~m/coorDeb/\s\S*\s\S*\s\S*\s\S*\s\S*; #CoorDeb first, following by X1
$X1=$first; $X4=$second;
$lenght1=$second-$first; # Calculation of the lenght of first segment
$line =~ m//coorFin/(\s*)\S*\s*\S*\s*\S*\s*\S*\s*(\S*/); #CoorFin first, following by X1
$lenght2=$second-$first; # Calculation of the lenght of first segment
push(@elements1, $lenght1); #Push the lenght into a table to compute the mean of lenght for the segment n°1
push(@elements2, $lenght2); #Push the lenght into a table to compute the mean of lenght for the segment n°2
}
Can anyone help me with the regex please? Thank you.