fork(4) download
  1. import java.util.regex.*;
  2. def String fetchTokenValue(String toScan, String token) {
  3. def matcher = ( toScan =~ /.*${Pattern.quote(token)}:([^\]]*)].*/ )
  4. if(matcher.matches()) {
  5. return matcher.group(1)
  6. } else {
  7. return 'NO_DICE'
  8. }
  9. }
  10. println fetchTokenValue('swkokd sw:defroko swodjejr blah:fizzbuzz] wdkerko', 'blah')
Success #stdin #stdout 0.54s 332800KB
stdin
Standard input is empty
stdout
fizzbuzz