fork(1) download
  1. #!/usr/bin/perl
  2. # your code goes here
  3. local $/;
  4. $_=<DATA>;
  5.  
  6. while(/<div>((?0)|[^<]++|.)*?<\/div>/gs) {
  7. print "Found block: ", $&, "\n";
  8. }
  9.  
  10. __DATA__
  11. <div>
  12. <div>data1...... </div>
  13. <div>data2......</div>
  14. </div>
  15. dflkgdlfkglkfmg drgg
  16. <div>
  17. <div>data3...... </div>
  18. <div>data4......</div>
  19. </div>
Success #stdin #stdout 0s 17496KB
stdin
Standard input is empty
stdout
Found block: <div>
    <div>data1...... </div>
    <div>data2......</div>
</div>
Found block: <div>
    <div>data3...... </div>
    <div>data4......</div>
</div>