fork(1) download
  1. #!/bin/bash
  2. text="random date (entry1) some more random data (entry2) random (entry3) random data (entry4)"
  3. brackets_regex="\(([^()]*)\)"
  4. for s in ${text[@]}; do
  5. if [[ ${s} =~ $brackets_regex ]]; then
  6. echo ${BASH_REMATCH[1]};
  7. fi
  8. done
Success #stdin #stdout 0s 5044KB
stdin
Standard input is empty
stdout
entry1
entry2
entry3
entry4