Name: KotlinVerbalExpressions
Owner: VerbalExpressions
Description: Kotlin regular expressions made easy.
Created: 2017-05-30 17:43:13.0
Updated: 2018-05-04 21:53:15.0
Pushed: 2018-03-02 10:06:09.0
Homepage: null
Size: 120
Language: Kotlin
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This is a Kotlin implementation of VerbalExpressions, mostly based on the Java, Swift, and Scala implementations.
Simple URL test:
verex = VerEx()
.startOfLine()
.then("http")
.maybe("s")
.then("://")
.maybe("www")
.anythingBut(" ")
.endOfLine()
url = "https://www.google.com"
egular test with VerEx method
erex.test(url)) {
println("Correct url")
est with infix extension
rl matches verex) {
println("Correct url")
Replacing strings:
str = "I like birds and bridges"
verex = VerEx()
.then("b")
.anythingBut(" ").zeroOrMore()
result = verex.replace(str, "trains")
tln(result) // I like trains and trains
For more usage examples, see the included tests.
endency>
roupId>co.zsmb</groupId>
rtifactId>kotlinverbalexpressions</artifactId>
ersion>0.1</version>
pendency>
sitories {
jcenter()
// or, alternatively:
maven { url 'https://dl.bintray.com/zsmb13/KotlinVerbalExpressions/' }
ndencies {
compile 'co.zsmb:kotlinverbalexpressions:0.1'