fork(1) download
  1. class Ideone {
  2. static void main(String[] args) {
  3. String s = "user stuff here 5\nuser banana1 pswd 4\nuser lemon2 pswd 5\nmumbo jumbo 12333 3\nuser h3lp pswd 8"
  4. def re = /\buser\s+\S+\s+pswd\s+(\d+)/
  5. def res = (s =~ re).collect { it[1] }
  6. print(res)
  7.  
  8. }
  9. }
  10.  
Success #stdin #stdout 2.06s 141624KB
stdin
Standard input is empty
stdout
[4, 5, 8]