Skip to content

Instantly share code, notes, and snippets.

@abelsromero
Created August 22, 2016 15:01
Show Gist options
  • Select an option

  • Save abelsromero/6162be84ec329c54a57a482172736116 to your computer and use it in GitHub Desktop.

Select an option

Save abelsromero/6162be84ec329c54a57a482172736116 to your computer and use it in GitHub Desktop.
def extract(String text) {
(text =~ /([a-z]+)((\.[a-z]+)*?)/).collect { it[0] }
}
/**
* println extract('groovy.grails.ruby.rails')
*
* $> [groovy, grails, ruby, rails]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment