正則表達式:java
fun main(){ val source="hello,my phone number is : 020-87654321." val pattern=""".*(\d{3}-\d{8}).""" Regex(pattern).findAll(source).toList().flatMap(MatchResult::groupValues).forEach(::println) }