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.
// 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 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.
Include this module into your project with:
import verex;
- .anything()
- .anythingBut(string value)
- .something()
- .somethingBut(stringvalue)
- .endOfLine()
- .find(string value)
- .maybe(string value)
- .startOfLine()
- .then(string value)
- .any(string value)
- .anyOf(string value)
- .br()
- .lineBreak()
- .range(string[] args)
- .tab()
- .word()
- .withAnyCase()
- .searchOneLine()
- .searchGlobal()
- .replace(string source, string value)
- .test()
- .add( expression )
- .multiple(string value)
- .alt()
You can view all implementations on VerbalExpressions.github.io