fork(1) download
  1. def target = 'How now brown ${animal}. The ${role} has oddly-shaped ${bodyPart}.'
  2. println target.replaceAll(/\$\{([^{}]*)\}/, '?')
  3.  
  4. def lst = new ArrayList<>();
  5. def m = target =~ /\$\{([^{}]*)\}/
  6. (0..<m.count).each { lst.add(m[it][1]) }
  7. println lst
  8.  
  9.  
  10.  
  11.  
Success #stdin #stdout 1.57s 333376KB
stdin
Standard input is empty
stdout
How now brown ?. The ? has oddly-shaped ?.
[animal, role, bodyPart]