fun main(args: Array<String>) {
val text = " \"id\": \"5jaq2\", \"mood\" \"id\": \"RKlvj\", \"is_verified\" \"id\": \"XPyZj\", \"mood\""
val regex = Regex("id\": (.*?)[,]")
val matches = regex.findAll(text)
val names = matches.map { it.groupValues[1] }.toList()
println(names)
}
I want to find all the id's but if "is_verified" is after id, I dont want to put it in a list.
Current result: ["5jaq2", "RKlvj", "XPyZj"]
Expected: ["5jaq2", "XPyZj"]
Any idea how to do this correctly?