#!/usr/bin/perl use strict; use warnings; my $string = '[1,962,[["x",0,"0.1","1.106"]]][1,963,[["x",0,"0.663","0.0"]]]'; $string .= '[1][1,562,[["x",0,"0.579","1.1"]]][1,563,[["x",0,"0.546","0.0"],["x",0,"0.94","1.8"]]]'; my @matches = ( $string =~ m/(\[.+?\])\[/g ); for (@matches) { print "$_\n"; } __DATA__ Erhofft: [1,962,[["x",0,"0.1","1.106"]]] [1,963,[["x",0,"0.663","0.0"]]] [1] [1,562,[["x",0,"0.579","1.1"]]] [1,563,[["x",0,"0.546","0.0"],["x",0,"0.94","1.8"]]] Realitaet: [1,962,[["x",0,"0.1","1.106"]]] [["x",0,"0.663","0.0"]]] [1,562,[["x",0,"0.579","1.1"]]]