fork(1) download
  1. set a "abc 1234 (comment)"
  2. regexp {(\w+)\s+(\d+)\s+\(([^()]+)\)} $a - body num comment
  3. puts $body
  4. puts $num
  5. puts $comment
  6.  
  7. set a1 "abc 1234 more 5678 text 890 here 678 (comment)"
  8. regexp {(\w+)\s+(\d+)(?:\s+\w+\s+\d+)*\s+\(([^()]+)\)} $a - body1 num1 comment1
  9. puts "'$body1'"
  10. puts "'$num1'"
  11. puts "'$comment1'"
  12.  
  13.  
Success #stdin #stdout 0s 16000KB
stdin
Standard input is empty
stdout
abc
1234
comment
'abc'
'1234'
'comment'