Skip to content

VerbalExpressions/ScalaVerbalExpressions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status

ScalaVerbalExpressions

import com.github.verbalexpressions.VerbalExpression
import VerbalExpression._

val validUrl = $.startOfLine()
                .andThen("http")
                .maybe("s")
                .andThen("://")
                .maybe("www.")
                .anythingBut(" ")
                .endOfLine()

assert("https://www.google.com" is validUrl)
assert("ftp://home.comcast.net" isNot validUrl)

// VerbalExpressions can be nested within each other
val fraction = $.andThen(".").digits()
val number = $.maybe("-").digits().maybe(fraction)

assert(Seq("3", "-4", "-0.458") forall number.check)
assert(Seq("0.", "hello", "4.3.2") forall number.notMatch)

For more methods, checkout the wiki and the source

sbt

Add the following to your build.sbt:

resolvers += "Sonatype releases" at "https://oss.sonatype.org/content/repositories/releases/"

libraryDependency += "com.github.verbalexpressions" %% "scalaverbalexpression" % "1.0.1"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages