Guest User

Untitled

a guest
Jul 15th, 2018
84
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fun main(args: Array<String>) {
  2.     val input = """ABCDE This is some text.
  3. This is more text. ABCDE, ABCDE.
  4. ABCDE And this is [ABCDE] still more text."""
  5.    
  6.     val regex = Regex("ABCDE")
  7.     var count = 1
  8.     val result = regex.replace(input) {
  9.         _ -> "X" + count++
  10.     }
  11.     println(result)
  12. }
RAW Paste Data