VerbalExpressions/KotlinVerbalExpressions

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

KotlinVerbalExpressions Build Status

This is a Kotlin implementation of VerbalExpressions, mostly based on the Java, Swift, and Scala implementations.

Examples

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.

Installation
Maven
endency>
roupId>co.zsmb</groupId>
rtifactId>kotlinverbalexpressions</artifactId>
ersion>0.1</version>
pendency>
Gradle
sitories {
jcenter()
// or, alternatively:
maven { url 'https://dl.bintray.com/zsmb13/KotlinVerbalExpressions/' }


ndencies {
compile 'co.zsmb:kotlinverbalexpressions:0.1'


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.