fun main() {
// Declare the regex pattern
val pattern = Regex("^htt+p$")
// Test strings
val testStrings = listOf("http", "htttp", "httttp", "httpp", "htp")
// Check matches
for (test in testStrings) {
val matches = pattern.matches(test)
println("Matches \"$test\": $matches")
}
}
// Matches "httpp": True or false, depending on how matches() method works
/*
run:
Matches "http": true
Matches "htttp": true
Matches "httttp": true
Matches "httpp": false
Matches "htp": false
*/