fork(6) download
  1. $str = 'pattern 2 [after] 123 abc DEX';
  2.  
  3. if ($str =~ m/^pattern\s+(\d+)\s+\[after\]\s+(.+)/) {
  4. print "$1\t$2\n";
  5. } else {
  6. print "(no match)\n";
  7. }
Success #stdin #stdout 0s 4552KB
stdin
Standard input is empty
stdout
2	123 abc DEX