Groovy web console

subscribe to the feed Subscribe
to this
site
John 1 (via #groovywebconsole)
tweet this snippet Tweet
this
script

John 1

Published 3 months ago by Michael
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import java.util.regex.*
String testString = 'OW 06/27 22:00 - NEW: 27-JUN-2017 22:00:00 GMT TO 28-JUN-2017 04:00:00 GMTMAINTENANCE LOCATIONS: BUDAPEST, HUNGARY'
String datetimeRegex = '[0-9]{2}-[a-zA-Z]{3}-[0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2}'

Matcher datetimeMatcher = testString =~ datetimeRegex

assert datetimeMatcher.find()

println(datetimeMatcher.group(0))