Rename methods in Regex. Add matchEntire method to match entire string against regex.

This commit is contained in:
Ilya Gorbunov
2015-10-14 07:44:19 +03:00
parent d860f335a3
commit d1d865aa0f
7 changed files with 80 additions and 26 deletions
+4 -4
View File
@@ -1,17 +1,17 @@
package test.text
import kotlin.test.*
import org.junit.Test as test
import org.junit.Test
class RegexJVMTest {
@test fun matchGroups() {
@Test fun matchGroups() {
val input = "1a 2b 3c"
val regex = "(\\d)(\\w)".toRegex()
val matches = regex.matchAll(input).toList()
assertTrue(matches.all { it.groups.size() == 3 })
val matches = regex.findAll(input).toList()
assertTrue(matches.all { it.groups.size == 3 })
val m1 = matches[0]
assertEquals("1a", m1.groups[0]?.value)
assertEquals(0..1, m1.groups[0]?.range)