Skip to content

VerbalExpressions/DVerbalExpressions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DVerbalExpressions

Regular Expressions made easy

Verbal Expressions is a D module that helps to construct difficult regular expressions.

This D module is based off of the original Javascript Verbal expressions library by jehna.

Examples

Testing if we have a valid URL

// Create the class to test the regular expression
auto e = (new VerEx())
         .searchOneLine()
         .startOfLine()
         .then("http")
         .maybe("s")
         .then("://")
         .maybe("www.")
         .anythingBut(" ")
         .endOfLine();
         
// Use VerEx.test() function to find if it matches.
writefln("Match? %s", e.test("http://www.google.es") ? "yes" : "no");

Compiling

Compiling the module using DMD:

$ dmd verex.d

Compiling your application with this module using DMD:

$ dmd -ofmy_application my_application.d verex.o

You can use varios DMD options to compile in 'debug', 'release' or 'unittest' modes.

Using in your project

Include this module into your project with:

import verex;

API

Terms

  • .anything()
  • .anythingBut(string value)
  • .something()
  • .somethingBut(stringvalue)
  • .endOfLine()
  • .find(string value)
  • .maybe(string value)
  • .startOfLine()
  • .then(string value)

Special characters and groups

  • .any(string value)
  • .anyOf(string value)
  • .br()
  • .lineBreak()
  • .range(string[] args)
  • .tab()
  • .word()

Modifiers

  • .withAnyCase()
  • .searchOneLine()
  • .searchGlobal()

Functions

  • .replace(string source, string value)
  • .test()

Other

  • .add( expression )
  • .multiple(string value)
  • .alt()

Other implementations

You can view all implementations on VerbalExpressions.github.io

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages