fork download
  1. import java.util.*
  2.  
  3. fun main(args: Array<String>) {
  4. val text = "Extract all words but word1 and word2."
  5. val matcher = Regex("""\b(?!(?:word1|word2)\b)\w+""")
  6. println( matcher.findAll(text).map{it.value}.toList() )
  7.  
  8. }
Success #stdin #stdout 0.11s 36396KB
stdin
Standard input is empty
stdout
[Extract, all, words, but, and]